home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / DJDEV203.ZIP / info / libc.info < prev    next >
Encoding:
GNU Info File  |  2000-01-05  |  811.1 KB  |  35,933 lines

  1. This is Info file ../../info/libc.info, produced by Makeinfo version
  2. 1.68 from the input file libc.tex.
  3.  
  4. This is the reference manual for libc.a
  5.  
  6. Copyright (c) 1996 DJ Delorie
  7.  
  8. 
  9. File: libc.info,  Node: Top,  Next: Introduction,  Prev: (dir),  Up: (dir)
  10.  
  11. * Menu:
  12.  
  13. * Introduction::
  14.  
  15. * Functional Categories::  All public symbols listed by
  16.                            category
  17.  
  18. * Alphabetical List::      All public symbols in alphabetical
  19.                            order
  20.  
  21. * Unimplemented::          Compatibility functions that either
  22.                            always fail or do nothing
  23.  
  24. * Master Index::
  25.  
  26. 
  27. File: libc.info,  Node: Introduction,  Next: Functional Categories,  Prev: Top,  Up: Top
  28.  
  29. Introduction
  30. ************
  31.  
  32. The standard C library, `libc.a', is automatically linked into your
  33. programs by the `gcc' control program.  It provides many of the
  34. functions that are normally associated with C programs.  This document
  35. gives the proper usage information about each of the functions and
  36. variables found in `libc.a'.
  37.  
  38. For each function or variable that the library provides, the definition
  39. of that symbol will include information on which header files to include
  40. in your source to obtain prototypes and type definitions relevant to the
  41. use of that symbol.
  42.  
  43. Note that many of the functions in `libm.a' (the math library) are
  44. defined in `math.h' but are not present in libc.a.  Some are, which may
  45. get confusing, but the rule of thumb is this--the C library contains
  46. those functions that ANSI dictates must exist, so that you don't need
  47. the `-lm' if you only use ANSI functions.  In contrast, `libm.a'
  48. contains more functions and supports additional functionality such as
  49. the `matherr' call-back and compliance to several alternative standards
  50. of behavior in case of FP errors.  *Note libm::, for more details.
  51.  
  52. Debugging support functions are in the library `libdbg.a'; link your
  53. program with `-ldbg' to use them.
  54.  
  55. 
  56. File: libc.info,  Node: Functional Categories,  Next: Alphabetical List,  Prev: Introduction,  Up: Top
  57.  
  58. Functional Categories
  59. *********************
  60.  
  61. * Menu:
  62.  
  63. * bios functions::
  64. * conio functions::
  65. * cpu functions::
  66. * ctype functions::
  67. * debugging functions::
  68. * dos functions::
  69. * dpmi functions::
  70. * environment functions::
  71. * file system functions::
  72. * go32 functions::
  73. * io functions::
  74. * locale functions::
  75. * math functions::
  76. * memory functions::
  77. * misc functions::
  78. * mono functions::
  79. * posix functions::
  80. * process functions::
  81. * random number functions::
  82. * shell functions::
  83. * signal functions::
  84. * sound functions::
  85. * startup functions::
  86. * stdio functions::
  87. * string functions::
  88. * termios functions::
  89. * time functions::
  90. * unix functions::
  91.  
  92. 
  93. File: libc.info,  Node: bios functions,  Next: conio functions,  Up: Functional Categories
  94.  
  95. bios functions
  96. ==============
  97.  
  98. * Menu:
  99.  
  100. * _bios_disk::
  101. * _bios_equiplist::
  102. * _bios_keybrd::
  103. * _bios_memsize::
  104. * _bios_printer::
  105. * _bios_serialcom::
  106. * _bios_timeofday::
  107. * bioscom::
  108. * biosdisk::
  109. * biosequip::
  110. * bioskey::
  111. * biosmemory::
  112. * biosprint::
  113. * biostime::
  114. * getkey::
  115. * getxkey::
  116. * kbhit::
  117.  
  118. 
  119. File: libc.info,  Node: conio functions,  Next: cpu functions,  Prev: bios functions,  Up: Functional Categories
  120.  
  121. conio functions
  122. ===============
  123.  
  124. * Menu:
  125.  
  126. * blinkvideo::
  127. * cgets::
  128. * clreol::
  129. * clrscr::
  130. * _conio_kbhit::
  131. * cprintf::
  132. * cputs::
  133. * cscanf::
  134. * delline::
  135. * getch::
  136. * getche::
  137. * gettext::
  138. * gettextinfo::
  139. * gotoxy::
  140. * gppconio_init::
  141. * highvideo::
  142. * insline::
  143. * intensevideo::
  144. * lowvideo::
  145. * movetext::
  146. * normvideo::
  147. * putch::
  148. * puttext::
  149. * Screen Variables::
  150. * ScreenClear::
  151. * ScreenCols::
  152. * ScreenGetChar::
  153. * ScreenGetCursor::
  154. * ScreenMode::
  155. * ScreenPutChar::
  156. * ScreenPutString::
  157. * ScreenRetrieve::
  158. * ScreenRows::
  159. * ScreenSetCursor::
  160. * ScreenUpdate::
  161. * ScreenUpdateLine::
  162. * ScreenVisualBell::
  163. * _set_screen_lines::
  164. * _setcursortype::
  165. * textattr::
  166. * textbackground::
  167. * textcolor::
  168. * textmode::
  169. * ungetch::
  170. * wherex::
  171. * wherey::
  172. * window::
  173.  
  174. 
  175. File: libc.info,  Node: cpu functions,  Next: ctype functions,  Prev: conio functions,  Up: Functional Categories
  176.  
  177. cpu functions
  178. =============
  179.  
  180. * Menu:
  181.  
  182. * _8087::
  183. * _clear87::
  184. * _control87::
  185. * _detect_80387::
  186. * disable::
  187. * enable::
  188. * _fpreset::
  189. * htonl::
  190. * htons::
  191. * inb::
  192. * inp::
  193. * inportb::
  194. * inportl::
  195. * inportsb::
  196. * inportsl::
  197. * inportsw::
  198. * inportw::
  199. * inpw::
  200. * _my_cs::
  201. * _my_ds::
  202. * _my_ss::
  203. * ntohl::
  204. * ntohs::
  205. * outb::
  206. * outp::
  207. * outportb::
  208. * outportl::
  209. * outportsb::
  210. * outportsl::
  211. * outportsw::
  212. * outportw::
  213. * outpw::
  214. * _status87::
  215.  
  216. 
  217. File: libc.info,  Node: ctype functions,  Next: debugging functions,  Prev: cpu functions,  Up: Functional Categories
  218.  
  219. ctype functions
  220. ===============
  221.  
  222. * Menu:
  223.  
  224. * isalnum::
  225. * isalpha::
  226. * isascii::
  227. * iscntrl::
  228. * isdigit::
  229. * isgraph::
  230. * islower::
  231. * isprint::
  232. * ispunct::
  233. * isspace::
  234. * isupper::
  235. * isxdigit::
  236. * toascii::
  237. * tolower::
  238. * toupper::
  239.  
  240. 
  241. File: libc.info,  Node: debugging functions,  Next: dos functions,  Prev: ctype functions,  Up: Functional Categories
  242.  
  243. debugging functions
  244. ===================
  245.  
  246. * Menu:
  247.  
  248. * cleanup_client::
  249. * edi_init::
  250. * load_npx::
  251. * read_child::
  252. * read_sel_addr::
  253. * redir_cmdline_delete::
  254. * redir_cmdline_parse::
  255. * redir_debug_init::
  256. * redir_to_child::
  257. * redir_to_debugger::
  258. * run_child::
  259. * save_npx::
  260. * syms_init::
  261. * syms_line2val::
  262. * syms_listwild::
  263. * syms_module::
  264. * syms_name2val::
  265. * syms_val2line::
  266. * syms_val2name::
  267. * v2loadimage::
  268. * wild::
  269. * write_child::
  270. * write_sel_addr::
  271.  
  272. 
  273. File: libc.info,  Node: dos functions,  Next: dpmi functions,  Prev: debugging functions,  Up: Functional Categories
  274.  
  275. dos functions
  276. =============
  277.  
  278. * Menu:
  279.  
  280. * bdos::
  281. * bdosptr::
  282. * delay::
  283. * _dos_close::
  284. * _dos_commit::
  285. * _dos_creat::
  286. * _dos_creatnew::
  287. * _dos_findfirst::
  288. * _dos_findnext::
  289. * _dos_getdate::
  290. * _dos_getdiskfree::
  291. * _dos_getdrive::
  292. * _dos_getfileattr::
  293. * _dos_getftime::
  294. * _dos_gettime::
  295. * _dos_lock::
  296. * _dos_open::
  297. * _dos_read::
  298. * _dos_setdate::
  299. * _dos_setdrive::
  300. * _dos_setfileattr::
  301. * _dos_setftime::
  302. * _dos_settime::
  303. * _dos_unlock::
  304. * _dos_write::
  305. * _doserrno::
  306. * dosexterr::
  307. * _flush_disk_cache::
  308. * getcbrk::
  309. * getdisk::
  310. * int386::
  311. * int386x::
  312. * int86::
  313. * int86x::
  314. * intdos::
  315. * intdosx::
  316. * setcbrk::
  317. * setdisk::
  318.  
  319. 
  320. File: libc.info,  Node: dpmi functions,  Next: environment functions,  Prev: dos functions,  Up: Functional Categories
  321.  
  322. dpmi functions
  323. ==============
  324.  
  325. * Menu:
  326.  
  327. * DPMI Overview::
  328. * DPMI Specification::
  329. * __dpmi_allocate_dos_memory::
  330. * __dpmi_allocate_ldt_descriptors::
  331. * __dpmi_allocate_linear_memory::
  332. * __dpmi_allocate_memory::
  333. * __dpmi_allocate_real_mode_callback::
  334. * __dpmi_allocate_shared_memory::
  335. * __dpmi_allocate_specific_ldt_descriptor::
  336. * __dpmi_clear_debug_watchpoint::
  337. * __dpmi_create_alias_descriptor::
  338. * __dpmi_discard_page_contents::
  339. * __dpmi_free_dos_memory::
  340. * __dpmi_free_ldt_descriptor::
  341. * __dpmi_free_memory::
  342. * __dpmi_free_physical_address_mapping::
  343. * __dpmi_free_real_mode_callback::
  344. * __dpmi_free_serialization_on_shared_memory::
  345. * __dpmi_free_shared_memory::
  346. * __dpmi_get_and_disable_virtual_interrupt_state::
  347. * __dpmi_get_and_enable_virtual_interrupt_state::
  348. * __dpmi_get_and_set_virtual_interrupt_state::
  349. * __dpmi_get_capabilities::
  350. * __dpmi_get_coprocessor_status::
  351. * __dpmi_get_descriptor::
  352. * __dpmi_get_descriptor_access_rights::
  353. * __dpmi_get_extended_exception_handler_vector_pm::
  354. * __dpmi_get_extended_exception_handler_vector_rm::
  355. * __dpmi_get_free_memory_information::
  356. * __dpmi_get_memory_block_size_and_base::
  357. * __dpmi_get_memory_information::
  358. * __dpmi_get_multiple_descriptors::
  359. * __dpmi_get_page_attributes::
  360. * __dpmi_get_page_size::
  361. * __dpmi_get_processor_exception_handler_vector::
  362. * __dpmi_get_protected_mode_interrupt_vector::
  363. * __dpmi_get_raw_mode_switch_addr::
  364. * __dpmi_get_real_mode_interrupt_vector::
  365. * __dpmi_get_segment_base_address::
  366. * __dpmi_get_segment_limit::
  367. * __dpmi_get_selector_increment_value::
  368. * __dpmi_get_state_of_debug_watchpoint::
  369. * __dpmi_get_state_save_restore_addr::
  370. * __dpmi_get_vendor_specific_api_entry_point::
  371. * __dpmi_get_version::
  372. * __dpmi_get_virtual_interrupt_state::
  373. * __dpmi_install_resident_service_provider_callback::
  374. * __dpmi_int::
  375. * __dpmi_lock_linear_region::
  376. * __dpmi_map_conventional_memory_in_memory_block::
  377. * __dpmi_map_device_in_memory_block::
  378. * __dpmi_mark_page_as_demand_paging_candidate::
  379. * __dpmi_mark_real_mode_region_as_pageable::
  380. * __dpmi_physical_address_mapping::
  381. * __dpmi_relock_real_mode_region::
  382. * __dpmi_reset_debug_watchpoint::
  383. * __dpmi_resize_dos_memory::
  384. * __dpmi_resize_linear_memory::
  385. * __dpmi_resize_memory::
  386. * __dpmi_segment_to_descriptor::
  387. * __dpmi_serialize_on_shared_memory::
  388. * __dpmi_set_coprocessor_emulation::
  389. * __dpmi_set_debug_watchpoint::
  390. * __dpmi_set_descriptor::
  391. * __dpmi_set_descriptor_access_rights::
  392. * __dpmi_set_extended_exception_handler_vector_pm::
  393. * __dpmi_set_extended_exception_handler_vector_rm::
  394. * __dpmi_set_multiple_descriptors::
  395. * __dpmi_set_page_attributes::
  396. * __dpmi_set_processor_exception_handler_vector::
  397. * __dpmi_set_protected_mode_interrupt_vector::
  398. * __dpmi_set_real_mode_interrupt_vector::
  399. * __dpmi_set_segment_base_address::
  400. * __dpmi_set_segment_limit::
  401. * __dpmi_simulate_real_mode_interrupt::
  402. * __dpmi_simulate_real_mode_procedure_iret::
  403. * __dpmi_simulate_real_mode_procedure_retf::
  404. * __dpmi_simulate_real_mode_procedure_retf_stack::
  405. * __dpmi_terminate_and_stay_resident::
  406. * __dpmi_unlock_linear_region::
  407. * __dpmi_yield::
  408. * _go32_dpmi_allocate_dos_memory::
  409. * _go32_dpmi_allocate_iret_wrapper::
  410. * _go32_dpmi_allocate_real_mode_callback_iret::
  411. * _go32_dpmi_allocate_real_mode_callback_retf::
  412. * _go32_dpmi_chain_protected_mode_interrupt_vector::
  413. * _go32_dpmi_free_dos_memory::
  414. * _go32_dpmi_free_iret_wrapper::
  415. * _go32_dpmi_free_real_mode_callback::
  416. * _go32_dpmi_get_free_memory_information::
  417. * _go32_dpmi_get_protected_mode_interrupt_vector::
  418. * _go32_dpmi_get_real_mode_interrupt_vector::
  419. * _go32_dpmi_remaining_physical_memory::
  420. * _go32_dpmi_remaining_virtual_memory::
  421. * _go32_dpmi_resize_dos_memory::
  422. * _go32_dpmi_set_protected_mode_interrupt_vector::
  423. * _go32_dpmi_set_real_mode_interrupt_vector::
  424. * _go32_dpmi_simulate_fcall::
  425. * _go32_dpmi_simulate_fcall_iret::
  426. * _go32_dpmi_simulate_int::
  427. * _go32_info_block::
  428.  
  429. 
  430. File: libc.info,  Node: environment functions,  Next: file system functions,  Prev: dpmi functions,  Up: Functional Categories
  431.  
  432. environment functions
  433. =====================
  434.  
  435. * Menu:
  436.  
  437. * getenv::
  438. * putenv::
  439. * setenv::
  440.  
  441. 
  442. File: libc.info,  Node: file system functions,  Next: go32 functions,  Prev: environment functions,  Up: Functional Categories
  443.  
  444. file system functions
  445. =====================
  446.  
  447. * Menu:
  448.  
  449. * access::
  450. * basename::
  451. * chdir::
  452. * chmod::
  453. * _chmod::
  454. * _close::
  455. * closedir::
  456. * _creat::
  457. * _creatnew::
  458. * dirname::
  459. * File System Extensions::
  460. * __file_tree_walk::
  461. * findfirst::
  462. * findnext::
  463. * _fixpath::
  464. * fnmatch::
  465. * fnmerge::
  466. * fnsplit::
  467. * fpathconf::
  468. * __FSEXT_add_open_handler::
  469. * __FSEXT_alloc_fd::
  470. * __FSEXT_call_open_handlers::
  471. * __FSEXT_get_data::
  472. * __FSEXT_get_function::
  473. * __FSEXT_set_data::
  474. * __FSEXT_set_function::
  475. * ftw::
  476. * _get_volume_info::
  477. * getcwd::
  478. * getdfree::
  479. * getftime::
  480. * getwd::
  481. * _invent_inode::
  482. * _lfn_gen_short_fname::
  483. * _lfn_get_ftime::
  484. * mkdir::
  485. * mkstemp::
  486. * mktemp::
  487. * _open::
  488. * opendir::
  489. * _preserve_fncase::
  490. * _read::
  491. * readdir::
  492. * remove::
  493. * _rename::
  494. * rename::
  495. * rewinddir::
  496. * rmdir::
  497. * searchpath::
  498. * seekdir::
  499. * setftime::
  500. * statfs::
  501. * telldir::
  502. * tempnam::
  503. * umask::
  504. * unlink::
  505. * _use_lfn::
  506. * utime::
  507. * _write::
  508.  
  509. 
  510. File: libc.info,  Node: go32 functions,  Next: io functions,  Prev: file system functions,  Up: Functional Categories
  511.  
  512. go32 functions
  513. ==============
  514.  
  515. * Menu:
  516.  
  517. * _go32_conventional_mem_selector::
  518. * _go32_dpmi_lock_code::
  519. * _go32_dpmi_lock_data::
  520. * _go32_interrupt_stack_size::
  521. * _go32_my_cs::
  522. * _go32_my_ds::
  523. * _go32_my_ss::
  524. * _go32_rmcb_stack_size::
  525. * _go32_want_ctrl_break::
  526. * _go32_was_ctrl_break_hit::
  527.  
  528. 
  529. File: libc.info,  Node: io functions,  Next: locale functions,  Prev: go32 functions,  Up: Functional Categories
  530.  
  531. io functions
  532. ============
  533.  
  534. * Menu:
  535.  
  536. * chsize::
  537. * close::
  538. * creat::
  539. * crlf2nl::
  540. * __djgpp_share_flags::
  541. * dup::
  542. * dup2::
  543. * fcntl::
  544. * __file_exists::
  545. * filelength::
  546. * _get_dev_info::
  547. * ioctl (DOS)::
  548. * ioctl (General description)::
  549. * ioctl (UNIX)::
  550. * _is_executable::
  551. * _is_remote_drive::
  552. * _is_remote_handle::
  553. * link::
  554. * lock::
  555. * lseek::
  556. * open::
  557. * _put_path::
  558. * read::
  559. * setmode::
  560. * stat::
  561. * symlink::
  562. * tell::
  563. * truncate::
  564. * unlock::
  565. * write::
  566.  
  567. 
  568. File: libc.info,  Node: locale functions,  Next: math functions,  Prev: io functions,  Up: Functional Categories
  569.  
  570. locale functions
  571. ================
  572.  
  573. * Menu:
  574.  
  575. * localeconv::
  576. * mblen::
  577. * mbstowcs::
  578. * mbtowc::
  579. * setlocale::
  580. * strcoll::
  581. * strxfrm::
  582. * wcstombs::
  583. * wctomb::
  584.  
  585. 
  586. File: libc.info,  Node: math functions,  Next: memory functions,  Prev: locale functions,  Up: Functional Categories
  587.  
  588. math functions
  589. ==============
  590.  
  591. * Menu:
  592.  
  593. * abs::
  594. * acos::
  595. * acosh::
  596. * asin::
  597. * asinh::
  598. * atan::
  599. * atan2::
  600. * atanh::
  601. * cbrt::
  602. * ceil::
  603. * cos::
  604. * cosh::
  605. * div::
  606. * exp::
  607. * exp10::
  608. * exp2::
  609. * expm1::
  610. * fabs::
  611. * floor::
  612. * fmod::
  613. * frexp::
  614. * hypot::
  615. * ldexp::
  616. * ldiv::
  617. * libm::
  618. * lldiv::
  619. * log::
  620. * log10::
  621. * log1p::
  622. * log2::
  623. * matherr::
  624. * modf::
  625. * modfl::
  626. * pow::
  627. * pow10::
  628. * pow2::
  629. * powi::
  630. * sin::
  631. * sincos::
  632. * sinh::
  633. * sqrt::
  634. * tan::
  635. * tanh::
  636.  
  637. 
  638. File: libc.info,  Node: memory functions,  Next: misc functions,  Prev: math functions,  Up: Functional Categories
  639.  
  640. memory functions
  641. ================
  642.  
  643. * Menu:
  644.  
  645. * alloca::
  646. * bcmp::
  647. * bcopy::
  648. * brk::
  649. * bzero::
  650. * calloc::
  651. * cfree::
  652. * __djgpp_map_physical_memory::
  653. * __djgpp_memory_handle::
  654. * __djgpp_memory_handle_list::
  655. * __djgpp_nearptr_disable::
  656. * __djgpp_nearptr_enable::
  657. * __djgpp_set_page_attributes::
  658. * dosmemget::
  659. * dosmemgetb::
  660. * dosmemgetl::
  661. * dosmemgetw::
  662. * dosmemput::
  663. * dosmemputb::
  664. * dosmemputl::
  665. * dosmemputw::
  666. * _far*::
  667. * free::
  668. * malloc::
  669. * memccpy::
  670. * memchr::
  671. * memcmp::
  672. * memcpy::
  673. * memicmp::
  674. * memmove::
  675. * memset::
  676. * movedata::
  677. * movedatab::
  678. * movedatal::
  679. * movedataw::
  680. * mprotect::
  681. * realloc::
  682. * sbrk::
  683. * stackavail::
  684. * swab::
  685. * xfree::
  686. * xmalloc::
  687. * xrealloc::
  688.  
  689. 
  690. File: libc.info,  Node: misc functions,  Next: mono functions,  Prev: memory functions,  Up: Functional Categories
  691.  
  692. misc functions
  693. ==============
  694.  
  695. * Menu:
  696.  
  697. * assert::
  698. * bsearch::
  699. * _dxe_load::
  700. * _get_dos_version::
  701. * gethostname::
  702. * getlongpass::
  703. * getopt::
  704. * getpagesize::
  705. * getpass::
  706. * insque::
  707. * labs::
  708. * llabs::
  709. * longjmp::
  710. * qsort::
  711. * remque::
  712. * setjmp::
  713. * siglongjmp::
  714. * sigsetjmp::
  715. * varargs::
  716.  
  717. 
  718. File: libc.info,  Node: mono functions,  Next: posix functions,  Prev: misc functions,  Up: Functional Categories
  719.  
  720. mono functions
  721. ==============
  722.  
  723. * Menu:
  724.  
  725. * _mono_clear::
  726. * _mono_printf::
  727. * _mono_putc::
  728.  
  729. 
  730. File: libc.info,  Node: posix functions,  Next: process functions,  Prev: mono functions,  Up: Functional Categories
  731.  
  732. posix functions
  733. ===============
  734.  
  735. * Menu:
  736.  
  737. * ctermid::
  738. * getdtablesize::
  739. * pathconf::
  740. * sysconf::
  741.  
  742. 
  743. File: libc.info,  Node: process functions,  Next: random number functions,  Prev: posix functions,  Up: Functional Categories
  744.  
  745. process functions
  746. =================
  747.  
  748. * Menu:
  749.  
  750. * abort::
  751. * alarm::
  752. * atexit::
  753. * _check_v2_prog::
  754. * exec*::
  755. * __exit::
  756. * _exit::
  757. * exit::
  758. * getitimer::
  759. * kill::
  760. * nice::
  761. * pause::
  762. * setitimer::
  763. * sleep::
  764. * spawn*::
  765. * system::
  766. * usleep::
  767. * wait::
  768. * waitpid::
  769.  
  770. 
  771. File: libc.info,  Node: random number functions,  Next: shell functions,  Prev: process functions,  Up: Functional Categories
  772.  
  773. random number functions
  774. =======================
  775.  
  776. * Menu:
  777.  
  778. * initstate::
  779. * rand::
  780. * rand48::
  781. * random::
  782. * setstate::
  783. * srand::
  784. * srandom::
  785.  
  786. 
  787. File: libc.info,  Node: shell functions,  Next: signal functions,  Prev: random number functions,  Up: Functional Categories
  788.  
  789. shell functions
  790. ===============
  791.  
  792. * Menu:
  793.  
  794. * glob::
  795. * globfree::
  796.  
  797. 
  798. File: libc.info,  Node: signal functions,  Next: sound functions,  Prev: shell functions,  Up: Functional Categories
  799.  
  800. signal functions
  801. ================
  802.  
  803. * Menu:
  804.  
  805. * __djgpp_exception_toggle::
  806. * __djgpp_set_ctrl_c::
  807. * __djgpp_set_sigint_key::
  808. * __djgpp_set_sigquit_key::
  809. * __djgpp_traceback_exit::
  810. * psignal::
  811. * raise::
  812. * sigaction::
  813. * sigaddset::
  814. * sigdelset::
  815. * sigemptyset::
  816. * sigfillset::
  817. * sigismember::
  818. * signal::
  819. * sigpending::
  820. * sigprocmask::
  821.  
  822. 
  823. File: libc.info,  Node: sound functions,  Next: startup functions,  Prev: signal functions,  Up: Functional Categories
  824.  
  825. sound functions
  826. ===============
  827.  
  828. * Menu:
  829.  
  830. * nosound::
  831. * sound::
  832.  
  833. 
  834. File: libc.info,  Node: startup functions,  Next: stdio functions,  Prev: sound functions,  Up: Functional Categories
  835.  
  836. startup functions
  837. =================
  838.  
  839. * Menu:
  840.  
  841. * __crt0_glob_function::
  842. * __crt0_load_environment_file::
  843. * __crt0_setup_arguments::
  844. * _crt0_startup_flags::
  845. * _stklen::
  846.  
  847. 
  848. File: libc.info,  Node: stdio functions,  Next: string functions,  Prev: startup functions,  Up: Functional Categories
  849.  
  850. stdio functions
  851. ===============
  852.  
  853. * Menu:
  854.  
  855. * clearerr::
  856. * _djstat_describe_lossage::
  857. * _djstat_fail_bits::
  858. * _djstat_flags::
  859. * _doprnt::
  860. * _doscan::
  861. * errno::
  862. * fclose::
  863. * fdopen::
  864. * feof::
  865. * ferror::
  866. * fflush::
  867. * fgetc::
  868. * fgetpos::
  869. * fgets::
  870. * fileno::
  871. * _fmode::
  872. * fopen::
  873. * fprintf::
  874. * fpurge::
  875. * fputc::
  876. * fputs::
  877. * fread::
  878. * freopen::
  879. * fscanf::
  880. * fseek::
  881. * fsetpos::
  882. * fstat::
  883. * fsync::
  884. * ftell::
  885. * ftruncate::
  886. * _fwalk::
  887. * fwrite::
  888. * getc::
  889. * getchar::
  890. * gets::
  891. * getw::
  892. * perror::
  893. * printf::
  894. * putc::
  895. * putchar::
  896. * puts::
  897. * putw::
  898. * rewind::
  899. * scanf::
  900. * setbuf::
  901. * setbuffer::
  902. * setlinebuf::
  903. * setvbuf::
  904. * sprintf::
  905. * sscanf::
  906. * strerror::
  907. * sys_errlist::
  908. * sys_nerr::
  909. * tmpfile::
  910. * tmpnam::
  911. * _truename::
  912. * ungetc::
  913. * vfprintf::
  914. * vfscanf::
  915. * vprintf::
  916. * vscanf::
  917. * vsprintf::
  918. * vsscanf::
  919.  
  920. 
  921. File: libc.info,  Node: string functions,  Next: termios functions,  Prev: stdio functions,  Up: Functional Categories
  922.  
  923. string functions
  924. ================
  925.  
  926. * Menu:
  927.  
  928. * atof::
  929. * atoi::
  930. * atol::
  931. * _atold::
  932. * ecvt::
  933. * ecvtbuf::
  934. * fcvt::
  935. * fcvtbuf::
  936. * ffs::
  937. * gcvt::
  938. * index::
  939. * itoa::
  940. * regcomp::
  941. * regerror::
  942. * regexec::
  943. * regfree::
  944. * rindex::
  945. * stpcpy::
  946. * strcasecmp::
  947. * strcat::
  948. * strchr::
  949. * strcmp::
  950. * strcpy::
  951. * strcspn::
  952. * strdup::
  953. * stricmp::
  954. * strlen::
  955. * strlwr::
  956. * strncasecmp::
  957. * strncat::
  958. * strncmp::
  959. * strncpy::
  960. * strnicmp::
  961. * strpbrk::
  962. * strrchr::
  963. * strsep::
  964. * strspn::
  965. * strstr::
  966. * strtod::
  967. * strtok::
  968. * strtol::
  969. * _strtold::
  970. * strtoll::
  971. * strtoul::
  972. * strtoull::
  973. * strupr::
  974.  
  975. 
  976. File: libc.info,  Node: termios functions,  Next: time functions,  Prev: string functions,  Up: Functional Categories
  977.  
  978. termios functions
  979. =================
  980.  
  981. * Menu:
  982.  
  983. * cfgetispeed::
  984. * cfgetospeed::
  985. * cfmakeraw::
  986. * cfsetispeed::
  987. * cfsetospeed::
  988. * cfsetspeed::
  989. * __libc_termios_init::
  990. * tcdrain::
  991. * tcflow::
  992. * tcflush::
  993. * tcgetattr::
  994. * tcgetpgrp::
  995. * tcsendbreak::
  996. * tcsetattr::
  997. * tcsetpgrp::
  998. * Termios functions::
  999.  
  1000. 
  1001. File: libc.info,  Node: time functions,  Next: unix functions,  Prev: termios functions,  Up: Functional Categories
  1002.  
  1003. time functions
  1004. ==============
  1005.  
  1006. * Menu:
  1007.  
  1008. * asctime::
  1009. * clock::
  1010. * ctime::
  1011. * difftime::
  1012. * ftime::
  1013. * getdate::
  1014. * gettime::
  1015. * gettimeofday::
  1016. * gmtime::
  1017. * localtime::
  1018. * mktime::
  1019. * rawclock::
  1020. * setdate::
  1021. * settime::
  1022. * settimeofday::
  1023. * strftime::
  1024. * time::
  1025. * times::
  1026. * tzset::
  1027. * tzsetwall::
  1028. * uclock::
  1029. * utimes::
  1030.  
  1031. 
  1032. File: libc.info,  Node: unix functions,  Prev: time functions,  Up: Functional Categories
  1033.  
  1034. unix functions
  1035. ==============
  1036.  
  1037. * Menu:
  1038.  
  1039. * addmntent::
  1040. * chown::
  1041. * endgrent::
  1042. * endmntent::
  1043. * endpwent::
  1044. * fgetgrent::
  1045. * fork::
  1046. * getegid::
  1047. * geteuid::
  1048. * getgid::
  1049. * getgrent::
  1050. * getgrgid::
  1051. * getgrnam::
  1052. * getgroups::
  1053. * getlogin::
  1054. * getmntent::
  1055. * getpgrp::
  1056. * getpid::
  1057. * getpwent::
  1058. * getpwnam::
  1059. * getpwuid::
  1060. * getrlimit::
  1061. * getrusage::
  1062. * getuid::
  1063. * hasmntopt::
  1064. * isatty::
  1065. * mkfifo::
  1066. * mknod::
  1067. * pclose::
  1068. * pipe::
  1069. * popen::
  1070. * select::
  1071. * setgid::
  1072. * setgrent::
  1073. * setmntent::
  1074. * setpgid::
  1075. * setpwent::
  1076. * setrlimit::
  1077. * setsid::
  1078. * setuid::
  1079. * sync::
  1080. * ttyname::
  1081. * uname::
  1082. * vfork::
  1083.  
  1084. 
  1085. File: libc.info,  Node: Alphabetical List,  Next: Unimplemented,  Prev: Functional Categories,  Up: Top
  1086.  
  1087. Alphabetical List
  1088. *****************
  1089.  
  1090. * Menu:
  1091.  
  1092. * _8087::
  1093. * abort::
  1094. * abs::
  1095. * access::
  1096. * acos::
  1097. * acosh::
  1098. * addmntent::
  1099. * alarm::
  1100. * alloca::
  1101. * asctime::
  1102. * asin::
  1103. * asinh::
  1104. * assert::
  1105. * atan::
  1106. * atan2::
  1107. * atanh::
  1108. * atexit::
  1109. * atof::
  1110. * atoi::
  1111. * atol::
  1112. * _atold::
  1113. * basename::
  1114. * bcmp::
  1115. * bcopy::
  1116. * bdos::
  1117. * bdosptr::
  1118. * _bios_disk::
  1119. * _bios_equiplist::
  1120. * _bios_keybrd::
  1121. * _bios_memsize::
  1122. * _bios_printer::
  1123. * _bios_serialcom::
  1124. * _bios_timeofday::
  1125. * bioscom::
  1126. * biosdisk::
  1127. * biosequip::
  1128. * bioskey::
  1129. * biosmemory::
  1130. * biosprint::
  1131. * biostime::
  1132. * blinkvideo::
  1133. * brk::
  1134. * bsearch::
  1135. * bzero::
  1136. * calloc::
  1137. * cbrt::
  1138. * ceil::
  1139. * cfgetispeed::
  1140. * cfgetospeed::
  1141. * cfmakeraw::
  1142. * cfree::
  1143. * cfsetispeed::
  1144. * cfsetospeed::
  1145. * cfsetspeed::
  1146. * cgets::
  1147. * chdir::
  1148. * _check_v2_prog::
  1149. * chmod::
  1150. * _chmod::
  1151. * chown::
  1152. * chsize::
  1153. * cleanup_client::
  1154. * _clear87::
  1155. * clearerr::
  1156. * clock::
  1157. * close::
  1158. * _close::
  1159. * closedir::
  1160. * clreol::
  1161. * clrscr::
  1162. * _conio_kbhit::
  1163. * _control87::
  1164. * cos::
  1165. * cosh::
  1166. * cprintf::
  1167. * cputs::
  1168. * creat::
  1169. * _creat::
  1170. * _creatnew::
  1171. * crlf2nl::
  1172. * __crt0_glob_function::
  1173. * __crt0_load_environment_file::
  1174. * __crt0_setup_arguments::
  1175. * _crt0_startup_flags::
  1176. * cscanf::
  1177. * ctermid::
  1178. * ctime::
  1179. * delay::
  1180. * delline::
  1181. * _detect_80387::
  1182. * difftime::
  1183. * dirname::
  1184. * disable::
  1185. * div::
  1186. * __djgpp_exception_toggle::
  1187. * __djgpp_map_physical_memory::
  1188. * __djgpp_memory_handle::
  1189. * __djgpp_memory_handle_list::
  1190. * __djgpp_nearptr_disable::
  1191. * __djgpp_nearptr_enable::
  1192. * __djgpp_set_ctrl_c::
  1193. * __djgpp_set_page_attributes::
  1194. * __djgpp_set_sigint_key::
  1195. * __djgpp_set_sigquit_key::
  1196. * __djgpp_share_flags::
  1197. * __djgpp_traceback_exit::
  1198. * _djstat_describe_lossage::
  1199. * _djstat_fail_bits::
  1200. * _djstat_flags::
  1201. * _doprnt::
  1202. * _dos_close::
  1203. * _dos_commit::
  1204. * _dos_creat::
  1205. * _dos_creatnew::
  1206. * _dos_findfirst::
  1207. * _dos_findnext::
  1208. * _dos_getdate::
  1209. * _dos_getdiskfree::
  1210. * _dos_getdrive::
  1211. * _dos_getfileattr::
  1212. * _dos_getftime::
  1213. * _dos_gettime::
  1214. * _dos_lock::
  1215. * _dos_open::
  1216. * _dos_read::
  1217. * _dos_setdate::
  1218. * _dos_setdrive::
  1219. * _dos_setfileattr::
  1220. * _dos_setftime::
  1221. * _dos_settime::
  1222. * _dos_unlock::
  1223. * _dos_write::
  1224. * _doscan::
  1225. * _doserrno::
  1226. * dosexterr::
  1227. * dosmemget::
  1228. * dosmemgetb::
  1229. * dosmemgetl::
  1230. * dosmemgetw::
  1231. * dosmemput::
  1232. * dosmemputb::
  1233. * dosmemputl::
  1234. * dosmemputw::
  1235. * DPMI Overview::
  1236. * DPMI Specification::
  1237. * __dpmi_allocate_dos_memory::
  1238. * __dpmi_allocate_ldt_descriptors::
  1239. * __dpmi_allocate_linear_memory::
  1240. * __dpmi_allocate_memory::
  1241. * __dpmi_allocate_real_mode_callback::
  1242. * __dpmi_allocate_shared_memory::
  1243. * __dpmi_allocate_specific_ldt_descriptor::
  1244. * __dpmi_clear_debug_watchpoint::
  1245. * __dpmi_create_alias_descriptor::
  1246. * __dpmi_discard_page_contents::
  1247. * __dpmi_free_dos_memory::
  1248. * __dpmi_free_ldt_descriptor::
  1249. * __dpmi_free_memory::
  1250. * __dpmi_free_physical_address_mapping::
  1251. * __dpmi_free_real_mode_callback::
  1252. * __dpmi_free_serialization_on_shared_memory::
  1253. * __dpmi_free_shared_memory::
  1254. * __dpmi_get_and_disable_virtual_interrupt_state::
  1255. * __dpmi_get_and_enable_virtual_interrupt_state::
  1256. * __dpmi_get_and_set_virtual_interrupt_state::
  1257. * __dpmi_get_capabilities::
  1258. * __dpmi_get_coprocessor_status::
  1259. * __dpmi_get_descriptor::
  1260. * __dpmi_get_descriptor_access_rights::
  1261. * __dpmi_get_extended_exception_handler_vector_pm::
  1262. * __dpmi_get_extended_exception_handler_vector_rm::
  1263. * __dpmi_get_free_memory_information::
  1264. * __dpmi_get_memory_block_size_and_base::
  1265. * __dpmi_get_memory_information::
  1266. * __dpmi_get_multiple_descriptors::
  1267. * __dpmi_get_page_attributes::
  1268. * __dpmi_get_page_size::
  1269. * __dpmi_get_processor_exception_handler_vector::
  1270. * __dpmi_get_protected_mode_interrupt_vector::
  1271. * __dpmi_get_raw_mode_switch_addr::
  1272. * __dpmi_get_real_mode_interrupt_vector::
  1273. * __dpmi_get_segment_base_address::
  1274. * __dpmi_get_segment_limit::
  1275. * __dpmi_get_selector_increment_value::
  1276. * __dpmi_get_state_of_debug_watchpoint::
  1277. * __dpmi_get_state_save_restore_addr::
  1278. * __dpmi_get_vendor_specific_api_entry_point::
  1279. * __dpmi_get_version::
  1280. * __dpmi_get_virtual_interrupt_state::
  1281. * __dpmi_install_resident_service_provider_callback::
  1282. * __dpmi_int::
  1283. * __dpmi_lock_linear_region::
  1284. * __dpmi_map_conventional_memory_in_memory_block::
  1285. * __dpmi_map_device_in_memory_block::
  1286. * __dpmi_mark_page_as_demand_paging_candidate::
  1287. * __dpmi_mark_real_mode_region_as_pageable::
  1288. * __dpmi_physical_address_mapping::
  1289. * __dpmi_relock_real_mode_region::
  1290. * __dpmi_reset_debug_watchpoint::
  1291. * __dpmi_resize_dos_memory::
  1292. * __dpmi_resize_linear_memory::
  1293. * __dpmi_resize_memory::
  1294. * __dpmi_segment_to_descriptor::
  1295. * __dpmi_serialize_on_shared_memory::
  1296. * __dpmi_set_coprocessor_emulation::
  1297. * __dpmi_set_debug_watchpoint::
  1298. * __dpmi_set_descriptor::
  1299. * __dpmi_set_descriptor_access_rights::
  1300. * __dpmi_set_extended_exception_handler_vector_pm::
  1301. * __dpmi_set_extended_exception_handler_vector_rm::
  1302. * __dpmi_set_multiple_descriptors::
  1303. * __dpmi_set_page_attributes::
  1304. * __dpmi_set_processor_exception_handler_vector::
  1305. * __dpmi_set_protected_mode_interrupt_vector::
  1306. * __dpmi_set_real_mode_interrupt_vector::
  1307. * __dpmi_set_segment_base_address::
  1308. * __dpmi_set_segment_limit::
  1309. * __dpmi_simulate_real_mode_interrupt::
  1310. * __dpmi_simulate_real_mode_procedure_iret::
  1311. * __dpmi_simulate_real_mode_procedure_retf::
  1312. * __dpmi_simulate_real_mode_procedure_retf_stack::
  1313. * __dpmi_terminate_and_stay_resident::
  1314. * __dpmi_unlock_linear_region::
  1315. * __dpmi_yield::
  1316. * dup::
  1317. * dup2::
  1318. * _dxe_load::
  1319. * ecvt::
  1320. * ecvtbuf::
  1321. * edi_init::
  1322. * enable::
  1323. * endgrent::
  1324. * endmntent::
  1325. * endpwent::
  1326. * errno::
  1327. * exec*::
  1328. * __exit::
  1329. * _exit::
  1330. * exit::
  1331. * exp::
  1332. * exp10::
  1333. * exp2::
  1334. * expm1::
  1335. * fabs::
  1336. * _far*::
  1337. * fclose::
  1338. * fcntl::
  1339. * fcvt::
  1340. * fcvtbuf::
  1341. * fdopen::
  1342. * feof::
  1343. * ferror::
  1344. * fflush::
  1345. * ffs::
  1346. * fgetc::
  1347. * fgetgrent::
  1348. * fgetpos::
  1349. * fgets::
  1350. * File System Extensions::
  1351. * __file_exists::
  1352. * __file_tree_walk::
  1353. * filelength::
  1354. * fileno::
  1355. * findfirst::
  1356. * findnext::
  1357. * _fixpath::
  1358. * floor::
  1359. * _flush_disk_cache::
  1360. * fmod::
  1361. * _fmode::
  1362. * fnmatch::
  1363. * fnmerge::
  1364. * fnsplit::
  1365. * fopen::
  1366. * fork::
  1367. * fpathconf::
  1368. * _fpreset::
  1369. * fprintf::
  1370. * fpurge::
  1371. * fputc::
  1372. * fputs::
  1373. * fread::
  1374. * free::
  1375. * freopen::
  1376. * frexp::
  1377. * fscanf::
  1378. * fseek::
  1379. * fsetpos::
  1380. * __FSEXT_add_open_handler::
  1381. * __FSEXT_alloc_fd::
  1382. * __FSEXT_call_open_handlers::
  1383. * __FSEXT_get_data::
  1384. * __FSEXT_get_function::
  1385. * __FSEXT_set_data::
  1386. * __FSEXT_set_function::
  1387. * fstat::
  1388. * fsync::
  1389. * ftell::
  1390. * ftime::
  1391. * ftruncate::
  1392. * ftw::
  1393. * _fwalk::
  1394. * fwrite::
  1395. * gcvt::
  1396. * _get_dev_info::
  1397. * _get_dos_version::
  1398. * _get_volume_info::
  1399. * getc::
  1400. * getcbrk::
  1401. * getch::
  1402. * getchar::
  1403. * getche::
  1404. * getcwd::
  1405. * getdate::
  1406. * getdfree::
  1407. * getdisk::
  1408. * getdtablesize::
  1409. * getegid::
  1410. * getenv::
  1411. * geteuid::
  1412. * getftime::
  1413. * getgid::
  1414. * getgrent::
  1415. * getgrgid::
  1416. * getgrnam::
  1417. * getgroups::
  1418. * gethostname::
  1419. * getitimer::
  1420. * getkey::
  1421. * getlogin::
  1422. * getlongpass::
  1423. * getmntent::
  1424. * getopt::
  1425. * getpagesize::
  1426. * getpass::
  1427. * getpgrp::
  1428. * getpid::
  1429. * getpwent::
  1430. * getpwnam::
  1431. * getpwuid::
  1432. * getrlimit::
  1433. * getrusage::
  1434. * gets::
  1435. * gettext::
  1436. * gettextinfo::
  1437. * gettime::
  1438. * gettimeofday::
  1439. * getuid::
  1440. * getw::
  1441. * getwd::
  1442. * getxkey::
  1443. * glob::
  1444. * globfree::
  1445. * gmtime::
  1446. * _go32_conventional_mem_selector::
  1447. * _go32_dpmi_allocate_dos_memory::
  1448. * _go32_dpmi_allocate_iret_wrapper::
  1449. * _go32_dpmi_allocate_real_mode_callback_iret::
  1450. * _go32_dpmi_allocate_real_mode_callback_retf::
  1451. * _go32_dpmi_chain_protected_mode_interrupt_vector::
  1452. * _go32_dpmi_free_dos_memory::
  1453. * _go32_dpmi_free_iret_wrapper::
  1454. * _go32_dpmi_free_real_mode_callback::
  1455. * _go32_dpmi_get_free_memory_information::
  1456. * _go32_dpmi_get_protected_mode_interrupt_vector::
  1457. * _go32_dpmi_get_real_mode_interrupt_vector::
  1458. * _go32_dpmi_lock_code::
  1459. * _go32_dpmi_lock_data::
  1460. * _go32_dpmi_remaining_physical_memory::
  1461. * _go32_dpmi_remaining_virtual_memory::
  1462. * _go32_dpmi_resize_dos_memory::
  1463. * _go32_dpmi_set_protected_mode_interrupt_vector::
  1464. * _go32_dpmi_set_real_mode_interrupt_vector::
  1465. * _go32_dpmi_simulate_fcall::
  1466. * _go32_dpmi_simulate_fcall_iret::
  1467. * _go32_dpmi_simulate_int::
  1468. * _go32_info_block::
  1469. * _go32_interrupt_stack_size::
  1470. * _go32_my_cs::
  1471. * _go32_my_ds::
  1472. * _go32_my_ss::
  1473. * _go32_rmcb_stack_size::
  1474. * _go32_want_ctrl_break::
  1475. * _go32_was_ctrl_break_hit::
  1476. * gotoxy::
  1477. * gppconio_init::
  1478. * hasmntopt::
  1479. * highvideo::
  1480. * htonl::
  1481. * htons::
  1482. * hypot::
  1483. * inb::
  1484. * index::
  1485. * initstate::
  1486. * inp::
  1487. * inportb::
  1488. * inportl::
  1489. * inportsb::
  1490. * inportsl::
  1491. * inportsw::
  1492. * inportw::
  1493. * inpw::
  1494. * insline::
  1495. * insque::
  1496. * int386::
  1497. * int386x::
  1498. * int86::
  1499. * int86x::
  1500. * intdos::
  1501. * intdosx::
  1502. * intensevideo::
  1503. * _invent_inode::
  1504. * ioctl (DOS)::
  1505. * ioctl (General description)::
  1506. * ioctl (UNIX)::
  1507. * _is_executable::
  1508. * _is_remote_drive::
  1509. * _is_remote_handle::
  1510. * isalnum::
  1511. * isalpha::
  1512. * isascii::
  1513. * isatty::
  1514. * iscntrl::
  1515. * isdigit::
  1516. * isgraph::
  1517. * islower::
  1518. * isprint::
  1519. * ispunct::
  1520. * isspace::
  1521. * isupper::
  1522. * isxdigit::
  1523. * itoa::
  1524. * kbhit::
  1525. * kill::
  1526. * labs::
  1527. * ldexp::
  1528. * ldiv::
  1529. * _lfn_gen_short_fname::
  1530. * _lfn_get_ftime::
  1531. * __libc_termios_init::
  1532. * libm::
  1533. * link::
  1534. * llabs::
  1535. * lldiv::
  1536. * load_npx::
  1537. * localeconv::
  1538. * localtime::
  1539. * lock::
  1540. * log::
  1541. * log10::
  1542. * log1p::
  1543. * log2::
  1544. * longjmp::
  1545. * lowvideo::
  1546. * lseek::
  1547. * malloc::
  1548. * matherr::
  1549. * mblen::
  1550. * mbstowcs::
  1551. * mbtowc::
  1552. * memccpy::
  1553. * memchr::
  1554. * memcmp::
  1555. * memcpy::
  1556. * memicmp::
  1557. * memmove::
  1558. * memset::
  1559. * mkdir::
  1560. * mkfifo::
  1561. * mknod::
  1562. * mkstemp::
  1563. * mktemp::
  1564. * mktime::
  1565. * modf::
  1566. * modfl::
  1567. * _mono_clear::
  1568. * _mono_printf::
  1569. * _mono_putc::
  1570. * movedata::
  1571. * movedatab::
  1572. * movedatal::
  1573. * movedataw::
  1574. * movetext::
  1575. * mprotect::
  1576. * _my_cs::
  1577. * _my_ds::
  1578. * _my_ss::
  1579. * nice::
  1580. * normvideo::
  1581. * nosound::
  1582. * ntohl::
  1583. * ntohs::
  1584. * open::
  1585. * _open::
  1586. * opendir::
  1587. * outb::
  1588. * outp::
  1589. * outportb::
  1590. * outportl::
  1591. * outportsb::
  1592. * outportsl::
  1593. * outportsw::
  1594. * outportw::
  1595. * outpw::
  1596. * pathconf::
  1597. * pause::
  1598. * pclose::
  1599. * perror::
  1600. * pipe::
  1601. * popen::
  1602. * pow::
  1603. * pow10::
  1604. * pow2::
  1605. * powi::
  1606. * _preserve_fncase::
  1607. * printf::
  1608. * psignal::
  1609. * _put_path::
  1610. * putc::
  1611. * putch::
  1612. * putchar::
  1613. * putenv::
  1614. * puts::
  1615. * puttext::
  1616. * putw::
  1617. * qsort::
  1618. * raise::
  1619. * rand::
  1620. * rand48::
  1621. * random::
  1622. * rawclock::
  1623. * read::
  1624. * _read::
  1625. * read_child::
  1626. * read_sel_addr::
  1627. * readdir::
  1628. * realloc::
  1629. * redir_cmdline_delete::
  1630. * redir_cmdline_parse::
  1631. * redir_debug_init::
  1632. * redir_to_child::
  1633. * redir_to_debugger::
  1634. * regcomp::
  1635. * regerror::
  1636. * regexec::
  1637. * regfree::
  1638. * remove::
  1639. * remque::
  1640. * _rename::
  1641. * rename::
  1642. * rewind::
  1643. * rewinddir::
  1644. * rindex::
  1645. * rmdir::
  1646. * run_child::
  1647. * save_npx::
  1648. * sbrk::
  1649. * scanf::
  1650. * Screen Variables::
  1651. * ScreenClear::
  1652. * ScreenCols::
  1653. * ScreenGetChar::
  1654. * ScreenGetCursor::
  1655. * ScreenMode::
  1656. * ScreenPutChar::
  1657. * ScreenPutString::
  1658. * ScreenRetrieve::
  1659. * ScreenRows::
  1660. * ScreenSetCursor::
  1661. * ScreenUpdate::
  1662. * ScreenUpdateLine::
  1663. * ScreenVisualBell::
  1664. * searchpath::
  1665. * seekdir::
  1666. * select::
  1667. * _set_screen_lines::
  1668. * setbuf::
  1669. * setbuffer::
  1670. * setcbrk::
  1671. * _setcursortype::
  1672. * setdate::
  1673. * setdisk::
  1674. * setenv::
  1675. * setftime::
  1676. * setgid::
  1677. * setgrent::
  1678. * setitimer::
  1679. * setjmp::
  1680. * setlinebuf::
  1681. * setlocale::
  1682. * setmntent::
  1683. * setmode::
  1684. * setpgid::
  1685. * setpwent::
  1686. * setrlimit::
  1687. * setsid::
  1688. * setstate::
  1689. * settime::
  1690. * settimeofday::
  1691. * setuid::
  1692. * setvbuf::
  1693. * sigaction::
  1694. * sigaddset::
  1695. * sigdelset::
  1696. * sigemptyset::
  1697. * sigfillset::
  1698. * sigismember::
  1699. * siglongjmp::
  1700. * signal::
  1701. * sigpending::
  1702. * sigprocmask::
  1703. * sigsetjmp::
  1704. * sin::
  1705. * sincos::
  1706. * sinh::
  1707. * sleep::
  1708. * sound::
  1709. * spawn*::
  1710. * sprintf::
  1711. * sqrt::
  1712. * srand::
  1713. * srandom::
  1714. * sscanf::
  1715. * stackavail::
  1716. * stat::
  1717. * statfs::
  1718. * _status87::
  1719. * _stklen::
  1720. * stpcpy::
  1721. * strcasecmp::
  1722. * strcat::
  1723. * strchr::
  1724. * strcmp::
  1725. * strcoll::
  1726. * strcpy::
  1727. * strcspn::
  1728. * strdup::
  1729. * strerror::
  1730. * strftime::
  1731. * stricmp::
  1732. * strlen::
  1733. * strlwr::
  1734. * strncasecmp::
  1735. * strncat::
  1736. * strncmp::
  1737. * strncpy::
  1738. * strnicmp::
  1739. * strpbrk::
  1740. * strrchr::
  1741. * strsep::
  1742. * strspn::
  1743. * strstr::
  1744. * strtod::
  1745. * strtok::
  1746. * strtol::
  1747. * _strtold::
  1748. * strtoll::
  1749. * strtoul::
  1750. * strtoull::
  1751. * strupr::
  1752. * strxfrm::
  1753. * swab::
  1754. * symlink::
  1755. * syms_init::
  1756. * syms_line2val::
  1757. * syms_listwild::
  1758. * syms_module::
  1759. * syms_name2val::
  1760. * syms_val2line::
  1761. * syms_val2name::
  1762. * sync::
  1763. * sys_errlist::
  1764. * sys_nerr::
  1765. * sysconf::
  1766. * system::
  1767. * tan::
  1768. * tanh::
  1769. * tcdrain::
  1770. * tcflow::
  1771. * tcflush::
  1772. * tcgetattr::
  1773. * tcgetpgrp::
  1774. * tcsendbreak::
  1775. * tcsetattr::
  1776. * tcsetpgrp::
  1777. * tell::
  1778. * telldir::
  1779. * tempnam::
  1780. * Termios functions::
  1781. * textattr::
  1782. * textbackground::
  1783. * textcolor::
  1784. * textmode::
  1785. * time::
  1786. * times::
  1787. * tmpfile::
  1788. * tmpnam::
  1789. * toascii::
  1790. * tolower::
  1791. * toupper::
  1792. * _truename::
  1793. * truncate::
  1794. * ttyname::
  1795. * tzset::
  1796. * tzsetwall::
  1797. * uclock::
  1798. * umask::
  1799. * uname::
  1800. * ungetc::
  1801. * ungetch::
  1802. * unlink::
  1803. * unlock::
  1804. * _use_lfn::
  1805. * usleep::
  1806. * utime::
  1807. * utimes::
  1808. * v2loadimage::
  1809. * varargs::
  1810. * vfork::
  1811. * vfprintf::
  1812. * vfscanf::
  1813. * vprintf::
  1814. * vscanf::
  1815. * vsprintf::
  1816. * vsscanf::
  1817. * wait::
  1818. * waitpid::
  1819. * wcstombs::
  1820. * wctomb::
  1821. * wherex::
  1822. * wherey::
  1823. * wild::
  1824. * window::
  1825. * write::
  1826. * _write::
  1827. * write_child::
  1828. * write_sel_addr::
  1829. * xfree::
  1830. * xmalloc::
  1831. * xrealloc::
  1832.  
  1833. 
  1834. File: libc.info,  Node: _8087,  Next: abort,  Up: Alphabetical List
  1835.  
  1836. _8087
  1837. =====
  1838.  
  1839. Syntax
  1840. ------
  1841.  
  1842.      #include <dos.h>
  1843.      
  1844.      extern int _8087;
  1845.  
  1846. Description
  1847. -----------
  1848.  
  1849. This variable is provided for compatibility with other DOS compilers.
  1850. It contains `3' if a numeric coprocessor is installed, otherwise `0'.
  1851. If the environment variable `387' is set to either `y' or `n', the
  1852. value of `_8087' reflects the override (i.e., `_8087' is
  1853. unconditionally assigned the value 3 if `387' is set to `y', 0 if it is
  1854. set to `n').
  1855.  
  1856. Portability
  1857. -----------
  1858.  
  1859. not ANSI, not POSIX
  1860.  
  1861. 
  1862. File: libc.info,  Node: abort,  Next: abs,  Prev: _8087,  Up: Alphabetical List
  1863.  
  1864. abort
  1865. =====
  1866.  
  1867. Syntax
  1868. ------
  1869.  
  1870.      #include <stdlib.h>
  1871.      
  1872.      void abort(void);
  1873.  
  1874. Description
  1875. -----------
  1876.  
  1877. When you call `abort', the message "Abort!" is printed on stdout and
  1878. the program is aborted by calling `raise (SIGABRT)' (*note SIGABRT:
  1879. signal.).  By default, this causes the CPU registers and the call frame
  1880. stack dump to be printed, and the program then exits with an exit code
  1881. of -1 (255).  If the `SIGABRT' signal is caught by a handler that
  1882. returns, the program exits with an exit code of 1.
  1883.  
  1884. Return Value
  1885. ------------
  1886.  
  1887. This function does not return.
  1888.  
  1889. Portability
  1890. -----------
  1891.  
  1892. ANSI, POSIX
  1893.  
  1894. Example
  1895. -------
  1896.  
  1897.      if ((q = malloc(100)) == NULL)
  1898.        abort();
  1899.  
  1900. 
  1901. File: libc.info,  Node: abs,  Next: access,  Prev: abort,  Up: Alphabetical List
  1902.  
  1903. abs
  1904. ===
  1905.  
  1906. Syntax
  1907. ------
  1908.  
  1909.      #include <stdlib.h>
  1910.      
  1911.      int abs(int value);
  1912.  
  1913. Return Value
  1914. ------------
  1915.  
  1916. The absolute value of `value' is returned.
  1917.  
  1918. Portability
  1919. -----------
  1920.  
  1921. ANSI, POSIX
  1922.  
  1923. Example
  1924. -------
  1925.  
  1926.      int sq = 7;
  1927.      sq = sq * abs(sq) + 1;
  1928.  
  1929. 
  1930. File: libc.info,  Node: access,  Next: acos,  Prev: abs,  Up: Alphabetical List
  1931.  
  1932. access
  1933. ======
  1934.  
  1935. Syntax
  1936. ------
  1937.  
  1938.      #include <unistd.h>
  1939.      
  1940.      int access(const char *filename, int flags);
  1941.  
  1942. Description
  1943. -----------
  1944.  
  1945. This function determines what kind of access modes a given file allows.
  1946. The parameter FLAGS is the logical `or' of one or more of the following
  1947. flags:
  1948.  
  1949. `R_OK'
  1950.      Request if the file is readable.  Since all files are readable
  1951.      under MS-DOS, this access mode always exists.
  1952.  
  1953. `W_OK'
  1954.      Request if the file is writable.
  1955.  
  1956. `X_OK'
  1957.      Request if the file is executable.
  1958.  
  1959. `F_OK'
  1960.      Request if the file exists.
  1961.  
  1962. `D_OK'
  1963.      Request if the file is really a directory.
  1964.  
  1965. Return Value
  1966. ------------
  1967.  
  1968. Zero if the requested access mode is allowed, nonzero if not.
  1969.  
  1970. Portability
  1971. -----------
  1972.  
  1973. not ANSI, POSIX
  1974.  
  1975. Example
  1976. -------
  1977.  
  1978.      if (access("file.ext", W_OK))
  1979.        return ERROR_CANNOT_WRITE;
  1980.      open("file.ext", O_RDWR);
  1981.  
  1982. 
  1983. File: libc.info,  Node: acos,  Next: acosh,  Prev: access,  Up: Alphabetical List
  1984.  
  1985. acos
  1986. ====
  1987.  
  1988. Syntax
  1989. ------
  1990.  
  1991.      #include <math.h>
  1992.      
  1993.      double acos(double x);
  1994.  
  1995. Description
  1996. -----------
  1997.  
  1998. This function returns the angle in the range `[0..Pi]' radians whose
  1999. cosine is X.  If the absolute value of X is greater than 1, a domain
  2000. error occurs, and `errno' is set to `EDOM'.
  2001.  
  2002. Return Value
  2003. ------------
  2004.  
  2005. The arc cosine, in radians, of X.  If the absolute value of X is
  2006. greater than 1, the function returns a `NaN'.
  2007.  
  2008. Portability
  2009. -----------
  2010.  
  2011. ANSI, POSIX
  2012.  
  2013. 
  2014. File: libc.info,  Node: acosh,  Next: addmntent,  Prev: acos,  Up: Alphabetical List
  2015.  
  2016. acosh
  2017. =====
  2018.  
  2019. Syntax
  2020. ------
  2021.  
  2022.      #include <math.h>
  2023.      
  2024.      double acosh(double x);
  2025.  
  2026. Description
  2027. -----------
  2028.  
  2029. This function returns the inverse hyperbolic cosine of X.
  2030.  
  2031. Return Value
  2032. ------------
  2033.  
  2034. The inverse hyperbolic cosine of X.  If the value of X is less than 1,
  2035. the return value is `NaN' and `errno' is set to `EDOM'.
  2036.  
  2037. Portability
  2038. -----------
  2039.  
  2040. not ANSI, not POSIX
  2041.  
  2042. 
  2043. File: libc.info,  Node: addmntent,  Next: alarm,  Prev: acosh,  Up: Alphabetical List
  2044.  
  2045. addmntent
  2046. =========
  2047.  
  2048. Syntax
  2049. ------
  2050.  
  2051.      #include <mntent.h>
  2052.      
  2053.      int addmntent(FILE *filep, const struct mntent *mnt);
  2054.  
  2055. Description
  2056. -----------
  2057.  
  2058. This function is a no-op for MS-DOS, but is provided to assist in Unix
  2059. ports.  *Note getmntent::.
  2060.  
  2061. Return Value
  2062. ------------
  2063.  
  2064. This function always returns nonzero to signify an error.
  2065.  
  2066. Portability
  2067. -----------
  2068.  
  2069. not ANSI, not POSIX
  2070.  
  2071. 
  2072. File: libc.info,  Node: alarm,  Next: alloca,  Prev: addmntent,  Up: Alphabetical List
  2073.  
  2074. alarm
  2075. =====
  2076.  
  2077. Syntax
  2078. ------
  2079.  
  2080.      #include <unistd.h>
  2081.      
  2082.      unsigned alarm(unsigned seconds);
  2083.  
  2084. Description
  2085. -----------
  2086.  
  2087. This function causes the signal `SIGALRM' to be raised in SECONDS
  2088. seconds.  A value of zero for SECONDS cancels any pending alarm.  If an
  2089. alarm has previously been set, the new alarm delay will supercede the
  2090. prior call.
  2091.  
  2092. Note that signals in DJGPP are deferred when the program is inside a
  2093. real-mode (e.g., DOS) call or isn't touching its data; see *Note
  2094. signal::, for more details.
  2095.  
  2096. A misfeature of Windows 9X prevents the timer tick interrupt from being
  2097. delivered to programs that are in the background (i.e. don't have the
  2098. focus), even though the program itself might continue to run, if you
  2099. uncheck the `Background: Always suspend' property in the Property
  2100. Sheets.  Therefore, `alarm' will not work in background programs on
  2101. Windows 9X.
  2102.  
  2103. Return Value
  2104. ------------
  2105.  
  2106. The number of seconds remaining on the timer (i.e. always SECONDS).
  2107.  
  2108. Portability
  2109. -----------
  2110.  
  2111. not ANSI, POSIX
  2112.  
  2113. Example
  2114. -------
  2115.  
  2116.      signal(SIGALRM,my_alarm_routine);
  2117.      alarm(5);
  2118.  
  2119. 
  2120. File: libc.info,  Node: alloca,  Next: asctime,  Prev: alarm,  Up: Alphabetical List
  2121.  
  2122. alloca
  2123. ======
  2124.  
  2125. Syntax
  2126. ------
  2127.  
  2128.      #include <stdlib.h>
  2129.      
  2130.      void *alloca(size_t _size)
  2131.  
  2132. Description
  2133. -----------
  2134.  
  2135. Allocate memory that will be automatically released when the current
  2136. procedure exits.  Note that, when compiling with gcc, alloca is a
  2137. built-in function and not a library call.
  2138.  
  2139. Return Value
  2140. ------------
  2141.  
  2142. A pointer to the memory, else NULL.
  2143.  
  2144. Portability
  2145. -----------
  2146.  
  2147. not ANSI, not POSIX
  2148.  
  2149. Example
  2150. -------
  2151.  
  2152.      q = alloca(strlen(x)+1);
  2153.      strcpy(q, x);
  2154.  
  2155. 
  2156. File: libc.info,  Node: asctime,  Next: asin,  Prev: alloca,  Up: Alphabetical List
  2157.  
  2158. asctime
  2159. =======
  2160.  
  2161. Syntax
  2162. ------
  2163.  
  2164.      #include <time.h>
  2165.      
  2166.      char *asctime(const struct tm *tptr);
  2167.  
  2168. Description
  2169. -----------
  2170.  
  2171. This function returns an ASCII representation of the time represented by
  2172. TPTR.  The string returned is always 26 characters and has this format:
  2173.  
  2174.      Sun Jan 01 12:34:56 1993\n\0
  2175.  
  2176. The string pointed to is in a static buffer and will be overwritten with
  2177. each call to asctime.  The data should be copied if it needs to be
  2178. preserved.
  2179.  
  2180. The layout of the `struct tm' structure is like this:
  2181.  
  2182.      struct tm {
  2183.        int    tm_sec;    /* seconds after the minute [0-60] */
  2184.        int    tm_min;    /* minutes after the hour [0-59] */
  2185.        int    tm_hour;   /* hours since midnight [0-23] */
  2186.        int    tm_mday;   /* day of the month [1-31] */
  2187.        int    tm_mon;    /* months since January [0-11] */
  2188.        int    tm_year;   /* years since 1900 */
  2189.        int    tm_wday;   /* days since Sunday [0-6] */
  2190.        int    tm_yday;   /* days since January 1 [0-365] */
  2191.        int    tm_isdst;  /* Daylight Savings Time flag */
  2192.        long   tm_gmtoff; /* offset from GMT in seconds */
  2193.        char * tm_zone;   /* timezone abbreviation */
  2194.      };
  2195.  
  2196. Return Value
  2197. ------------
  2198.  
  2199. A pointer to the string.
  2200.  
  2201. Portability
  2202. -----------
  2203.  
  2204. ANSI, POSIX
  2205.  
  2206. Example
  2207. -------
  2208.  
  2209.      time_t now;
  2210.      time(&now);
  2211.      printf("The current time is %s", asctime(localtime(&now)));
  2212.  
  2213. 
  2214. File: libc.info,  Node: asin,  Next: asinh,  Prev: asctime,  Up: Alphabetical List
  2215.  
  2216. asin
  2217. ====
  2218.  
  2219. Syntax
  2220. ------
  2221.  
  2222.      #include <math.h>
  2223.      
  2224.      double asin(double x);
  2225.  
  2226. Description
  2227. -----------
  2228.  
  2229. This function returns the angle in the range `[-Pi/2..Pi/2]' whose sine
  2230. is X.
  2231.  
  2232. Return Value
  2233. ------------
  2234.  
  2235. The inverse sine, in radians, of X.  If the absolute value of X is
  2236. greater than 1, the return value is `NaN' and `errno' is set to `EDOM'.
  2237.  
  2238. Portability
  2239. -----------
  2240.  
  2241. ANSI, POSIX
  2242.  
  2243. 
  2244. File: libc.info,  Node: asinh,  Next: assert,  Prev: asin,  Up: Alphabetical List
  2245.  
  2246. asinh
  2247. =====
  2248.  
  2249. Syntax
  2250. ------
  2251.  
  2252.      #include <math.h>
  2253.      
  2254.      double asinh(double x);
  2255.  
  2256. Description
  2257. -----------
  2258.  
  2259. This function returns the inverse hyperbolic sine of the argument X.
  2260.  
  2261. Return Value
  2262. ------------
  2263.  
  2264. The inverse hyperbolic sine of X.  If the argument X is a `NaN', the
  2265. return value is `NaN' and `errno' is set to `EDOM'.  If X is a positive
  2266. or negative `Inf', the return value is equal to the value of X, and
  2267. `errno' is left unchanged.
  2268.  
  2269. Portability
  2270. -----------
  2271.  
  2272. not ANSI, not POSIX
  2273.  
  2274. 
  2275. File: libc.info,  Node: assert,  Next: atan,  Prev: asinh,  Up: Alphabetical List
  2276.  
  2277. assert
  2278. ======
  2279.  
  2280. Syntax
  2281. ------
  2282.  
  2283.      #define NDEBUG
  2284.      #include <assert.h>
  2285.      
  2286.      assert(expression);
  2287.      assertval(expression);
  2288.  
  2289. Description
  2290. -----------
  2291.  
  2292. These macros are used to assist in debugging.  The source code includes
  2293. references to assert and assertval, passing them expressions that should
  2294. be true (or non-zero).  When the expression equals zero, a diagnostic
  2295. message is printed to stderr and the program aborts.
  2296.  
  2297. If you define the macro `NDEBUG' before including `assert.h', then the
  2298. macros expand to nothing to reduce code size after debugging is done.
  2299.  
  2300. Return Value
  2301. ------------
  2302.  
  2303. `assert' returns one if it passes, else it aborts.
  2304.  
  2305. `assertval' returns the value of the expression if nonzero, else it
  2306. aborts.
  2307.  
  2308. Portability
  2309. -----------
  2310.  
  2311. ANSI (see note 1), POSIX (see note 2)
  2312.  
  2313. Notes:
  2314.  
  2315.   1. `assert' is ANSI, `assertval' is not.
  2316.  
  2317.   2. `assert' is Posix, `assertval' is not.
  2318.  
  2319. Example
  2320. -------
  2321.  
  2322.      int strdup(char *s)
  2323.      {
  2324.        assert(s != 0);
  2325.  
  2326. 
  2327. File: libc.info,  Node: atan,  Next: atan2,  Prev: assert,  Up: Alphabetical List
  2328.  
  2329. atan
  2330. ====
  2331.  
  2332. Syntax
  2333. ------
  2334.  
  2335.      #include <math.h>
  2336.      
  2337.      double atan(double x);
  2338.  
  2339. Description
  2340. -----------
  2341.  
  2342. This function computes the angle, in the range `[-Pi/2..Pi/2]' radians,
  2343. whose tangent is X.
  2344.  
  2345. Return Value
  2346. ------------
  2347.  
  2348. The arc tangent, in radians, of X.  If X is a `NaN', the return value
  2349. is `NaN' and `errno' is set to `EDOM'.  If X is a positive or negative
  2350. `Inf', the return value is equal to positive or negative `Pi/2',
  2351. respectively, and `errno' is left unchanged.
  2352.  
  2353. Portability
  2354. -----------
  2355.  
  2356. ANSI, POSIX
  2357.  
  2358. 
  2359. File: libc.info,  Node: atan2,  Next: atanh,  Prev: atan,  Up: Alphabetical List
  2360.  
  2361. atan2
  2362. =====
  2363.  
  2364. Syntax
  2365. ------
  2366.  
  2367.      #include <math.h>
  2368.      
  2369.      double atan2(double y, double x);
  2370.  
  2371. Description
  2372. -----------
  2373.  
  2374. This function computes the angle, in the range `[-Pi..Pi]' radians,
  2375. whose tangent is `Y/X'.  In other words, it computes the angle, in
  2376. radians, of the vector (X,Y) with respect to the `+x' axis, reckoning
  2377. the counterclockwise direction as positive, and returning the value in
  2378. the range `[-Pi, Pi]'.
  2379.  
  2380. Return Value
  2381. ------------
  2382.  
  2383. The arc tangent, in radians, of `Y/X'.  `Pi' is returned if X is
  2384. negative and Y is a negative zero, `-0.0'.  `-Pi' is returned, if X is
  2385. negative, and Y is a positive zero, `+0.0'.
  2386.  
  2387. If either X or Y is infinite, `atan2' returns, respectively, `Pi' with
  2388. the sign of Y or zero, and `errno' is left unchanged.  However, if
  2389. *both* arguments are infinite, the return value is `NaN' and `errno' is
  2390. set to `EDOM'.
  2391.  
  2392. A `NaN' is returned, and `errno' is set to `EDOM', if either X and Y
  2393. are both zero, or if either one of the arguments is a `NaN'.
  2394.  
  2395. Portability
  2396. -----------
  2397.  
  2398. ANSI, POSIX
  2399.  
  2400. 
  2401. File: libc.info,  Node: atanh,  Next: atexit,  Prev: atan2,  Up: Alphabetical List
  2402.  
  2403. atanh
  2404. =====
  2405.  
  2406. Syntax
  2407. ------
  2408.  
  2409.      #include <math.h>
  2410.      
  2411.      double atanh(double x);
  2412.  
  2413. Description
  2414. -----------
  2415.  
  2416. This function computes the inverse hyperbolic tangent of X.
  2417.  
  2418. Return Value
  2419. ------------
  2420.  
  2421. The inverse hyperbolic tangent of X.  If the the value of X is plus or
  2422. minus 1, the return value is an `Inf' with the same sign as the
  2423. argument X, and `errno' is set to `ERANGE'.  If the absolute value of X
  2424. is greater than 1, the return value is `NaN' and `errno' is set to
  2425. `EDOM'.
  2426.  
  2427. Portability
  2428. -----------
  2429.  
  2430. not ANSI, not POSIX
  2431.  
  2432. 
  2433. File: libc.info,  Node: atexit,  Next: atof,  Prev: atanh,  Up: Alphabetical List
  2434.  
  2435. atexit
  2436. ======
  2437.  
  2438. Syntax
  2439. ------
  2440.  
  2441.      #include <stdlib.h>
  2442.      
  2443.      int atexit(void (*func)(void));
  2444.  
  2445. Description
  2446. -----------
  2447.  
  2448. This function places the specified function FUNC on a list of functions
  2449. to be called when `exit' is called.  These functions are called as if a
  2450. last-in-first-out queue is used, that is, the last function registered
  2451. with `atexit' will be the first function called by `exit'.
  2452.  
  2453. At least 32 functions can be registered this way.
  2454.  
  2455. Return Value
  2456. ------------
  2457.  
  2458. Zero on success, non-zero on error.
  2459.  
  2460. Portability
  2461. -----------
  2462.  
  2463. ANSI, POSIX
  2464.  
  2465. Example
  2466. -------
  2467.  
  2468.      void exit_func()
  2469.      {
  2470.        remove("file.tmp");
  2471.      }
  2472.      
  2473.      ...
  2474.      atexit(exit_func);
  2475.      ...
  2476.  
  2477. 
  2478. File: libc.info,  Node: atof,  Next: atoi,  Prev: atexit,  Up: Alphabetical List
  2479.  
  2480. atof
  2481. ====
  2482.  
  2483. Syntax
  2484. ------
  2485.  
  2486.      #include <stdlib.h>
  2487.      
  2488.      double atof(const char *string);
  2489.  
  2490. Description
  2491. -----------
  2492.  
  2493. Convert as much of the string as possible to an equivalent double
  2494. precision real number.
  2495.  
  2496. This function is almost like `strtod(string, NULL)' (*note strtod::.).
  2497.  
  2498. Return Value
  2499. ------------
  2500.  
  2501. The equivalent value, or zero if the string does not represent a number.
  2502.  
  2503. Portability
  2504. -----------
  2505.  
  2506. ANSI, POSIX
  2507.  
  2508. Example
  2509. -------
  2510.  
  2511.      main(int argc, char **argv)
  2512.      {
  2513.        double d = atof(argv[1]);
  2514.        ...
  2515.  
  2516. 
  2517. File: libc.info,  Node: atoi,  Next: atol,  Prev: atof,  Up: Alphabetical List
  2518.  
  2519. atoi
  2520. ====
  2521.  
  2522. Syntax
  2523. ------
  2524.  
  2525.      #include <stdlib.h>
  2526.      
  2527.      int atoi(const char *string);
  2528.  
  2529. Description
  2530. -----------
  2531.  
  2532. Convert as much of the string as possible to an equivalent integer
  2533. value.
  2534.  
  2535. This function is almost like `(int)strtol(string, NULL, 10)' (*note
  2536. strtol::.).
  2537.  
  2538. Return Value
  2539. ------------
  2540.  
  2541. The equivalent value, or zero if the string does not represent a number.
  2542.  
  2543. Portability
  2544. -----------
  2545.  
  2546. ANSI, POSIX
  2547.  
  2548. Example
  2549. -------
  2550.  
  2551.      main(int argc, char **argv)
  2552.      {
  2553.        int i = atoi(argv[1]);
  2554.        ...
  2555.  
  2556. 
  2557. File: libc.info,  Node: atol,  Next: _atold,  Prev: atoi,  Up: Alphabetical List
  2558.  
  2559. atol
  2560. ====
  2561.  
  2562. Syntax
  2563. ------
  2564.  
  2565.      #include <stdlib.h>
  2566.      
  2567.      long atol(const char *string);
  2568.  
  2569. Description
  2570. -----------
  2571.  
  2572. Convert as much of the string as possible to an equivalent long integer
  2573. value.
  2574.  
  2575. This function is almost like `strtol(string, NULL, 10)' (*note
  2576. strtol::.).
  2577.  
  2578. Return Value
  2579. ------------
  2580.  
  2581. The equivalent value, or zero if the string does not represent a number.
  2582.  
  2583. Portability
  2584. -----------
  2585.  
  2586. ANSI, POSIX
  2587.  
  2588. Example
  2589. -------
  2590.  
  2591.      main(int argc, char **argv)
  2592.      {
  2593.        long l = atol(argv[1]);
  2594.        ...
  2595.  
  2596. 
  2597. File: libc.info,  Node: _atold,  Next: basename,  Prev: atol,  Up: Alphabetical List
  2598.  
  2599. _atold
  2600. ======
  2601.  
  2602. Syntax
  2603. ------
  2604.  
  2605.      #include <stdlib.h>
  2606.      
  2607.      long double _atold(const char *string);
  2608.  
  2609. Description
  2610. -----------
  2611.  
  2612. Convert as much of the string as possible to an equivalent long double
  2613. precision real number.
  2614.  
  2615. This function is almost like `_strtold(string, NULL)' (*note
  2616. _strtold::.).
  2617.  
  2618. Return Value
  2619. ------------
  2620.  
  2621. The equivalent value, or zero if the string does not represent a number.
  2622.  
  2623. Portability
  2624. -----------
  2625.  
  2626. not ANSI, not POSIX
  2627.  
  2628. Example
  2629. -------
  2630.  
  2631.      main(int argc, char **argv)
  2632.      {
  2633.        long double d = _atold(argv[1]);
  2634.        ...
  2635.  
  2636. 
  2637. File: libc.info,  Node: basename,  Next: bcmp,  Prev: _atold,  Up: Alphabetical List
  2638.  
  2639. basename
  2640. ========
  2641.  
  2642. Syntax
  2643. ------
  2644.  
  2645.      #include <unistd.h>
  2646.      
  2647.      char * basename (const char *fname);
  2648.  
  2649. Description
  2650. -----------
  2651.  
  2652. This function returns the "basename" of the file, which is the last
  2653. part of its full name given by FNAME, with the drive letter and leading
  2654. directories stripped off.  For example, the basename of
  2655. `c:/foo/bar/file.ext' is `file.ext', and the basename of `a:foo' is
  2656. `foo'.  Trailing slashes and backslashes are significant: the basename
  2657. of `c:/foo/bar/' is an empty string after the rightmost slash.
  2658.  
  2659. This function treats both forward- and backslashes like directory
  2660. separators, so it can handle file names with mixed styles of slashes.
  2661.  
  2662. Return Value
  2663. ------------
  2664.  
  2665. A pointer into the original file name where the basename starts.  Note
  2666. that this is *not* a new buffer allocated with `malloc'.  If FNAME is a
  2667. NULL pointer, the function will return a NULL pointer.
  2668.  
  2669. Portability
  2670. -----------
  2671.  
  2672. not ANSI, not POSIX
  2673.  
  2674. Example
  2675. -------
  2676.  
  2677.        if (strcmp (basename (file_name), "gcc.exe") == 0)
  2678.          printf ("The file %s is the GNU C/C++ compiler\n", file_name);
  2679.  
  2680. 
  2681. File: libc.info,  Node: bcmp,  Next: bcopy,  Prev: basename,  Up: Alphabetical List
  2682.  
  2683. bcmp
  2684. ====
  2685.  
  2686. Syntax
  2687. ------
  2688.  
  2689.      #include <string.h>
  2690.      
  2691.      int bcmp(const void *ptr1, const void *ptr2, int length);
  2692.  
  2693. Description
  2694. -----------
  2695.  
  2696. Compare memory pointed to by PTR1 and PTR2 for at most LENGTH bytes.
  2697.  
  2698. Return Value
  2699. ------------
  2700.  
  2701. The number of bytes remaining when the first mismatch occurred, or zero
  2702. if all bytes were equal.
  2703.  
  2704. Portability
  2705. -----------
  2706.  
  2707. not ANSI, not POSIX
  2708.  
  2709. Example
  2710. -------
  2711.  
  2712.      void f(char *s1, char *s2)
  2713.      {
  2714.        int l = bcmp(s1, s2, strlen(s1));
  2715.        printf("Difference: %s, %s\n", s1+strlen(s1)-l, s2+strlen(s1)-l);
  2716.      }
  2717.  
  2718. 
  2719. File: libc.info,  Node: bcopy,  Next: bdos,  Prev: bcmp,  Up: Alphabetical List
  2720.  
  2721. bcopy
  2722. =====
  2723.  
  2724. Syntax
  2725. ------
  2726.  
  2727.      #include <string.h>
  2728.      
  2729.      void bcopy(const void *source, void *dest, int length);
  2730.  
  2731. Description
  2732. -----------
  2733.  
  2734. Copy LENGTH bytes from SOURCE to DEST.  Overlapping regions are handled
  2735. properly, although this behavior is not portable.
  2736.  
  2737. Return Value
  2738. ------------
  2739.  
  2740. No value is returned.
  2741.  
  2742. Portability
  2743. -----------
  2744.  
  2745. not ANSI, not POSIX
  2746.  
  2747. Example
  2748. -------
  2749.  
  2750.      struct s a, b;
  2751.      bcopy(a, b, sizeof(struct s));
  2752.  
  2753. 
  2754. File: libc.info,  Node: bdos,  Next: bdosptr,  Prev: bcopy,  Up: Alphabetical List
  2755.  
  2756. bdos
  2757. ====
  2758.  
  2759. Syntax
  2760. ------
  2761.  
  2762.      #include <dos.h>
  2763.      
  2764.      int bdos(int func, unsigned dx, unsigned al);
  2765.  
  2766. Description
  2767. -----------
  2768.  
  2769. Calls function FUNC of the software interrupt 0x21, passing it AL as
  2770. the subfunction and (the lower 16 bit of) DX in the `DX' register.
  2771. This function will only work for a subset of DOS functions which
  2772. require no arguments at all, or take non-pointer arguments in the `AL'
  2773. and `DX' registers only.  For functions which require a pointer in the
  2774. `DX' register, use `bdosptr' (*note bdosptr::.).
  2775.  
  2776. Return Value
  2777. ------------
  2778.  
  2779. Whatever the called function returns in the AX register.
  2780.  
  2781. Portability
  2782. -----------
  2783.  
  2784. not ANSI, not POSIX
  2785.  
  2786. Example
  2787. -------
  2788.  
  2789.      /* read a character */
  2790.      int ch = bdos(1, 0, 0) & 0xff;
  2791.  
  2792. 
  2793. File: libc.info,  Node: bdosptr,  Next: _bios_disk,  Prev: bdos,  Up: Alphabetical List
  2794.  
  2795. bdosptr
  2796. =======
  2797.  
  2798. Syntax
  2799. ------
  2800.  
  2801.      #include <dos.h>
  2802.      
  2803.      int bdosptr(int func, void *ptr, unsigned al);
  2804.  
  2805. Description
  2806. -----------
  2807.  
  2808. Calls function FUNC of the software interrupt 0x21, passing it AL as
  2809. the subfunction and a pointer to a copy of the buffer contents whose
  2810. address is in PTR through the `DX' register.  This function will only
  2811. work for a subset of DOS which require an argument in the `AL' register
  2812. and a pointer in `DX' register.  For functions which require
  2813. non-pointer arguments in the `DX' register, use `bdos' (*note bdos::.).
  2814. To make the contents of PTR available to DOS, `bdosptr' copies it to
  2815. the transfer buffer located in the low (below 1 Meg mark) memory.
  2816.  
  2817. Currently, some of the functions which take a pointer to a buffer in
  2818. `DX' are *NOT* supported (notably, most of the FCB-based functions).
  2819. *Note int86::, for the list of supported functions.
  2820.  
  2821. Return Value
  2822. ------------
  2823.  
  2824. Whatever the called function returns in the AX register.
  2825.  
  2826. Portability
  2827. -----------
  2828.  
  2829. not ANSI, not POSIX
  2830.  
  2831. Example
  2832. -------
  2833.  
  2834.      /* print a string */
  2835.      bdosptr(9, "Hello, there$", 0);
  2836.  
  2837. 
  2838. File: libc.info,  Node: _bios_disk,  Next: _bios_equiplist,  Prev: bdosptr,  Up: Alphabetical List
  2839.  
  2840. _bios_disk
  2841. ==========
  2842.  
  2843. Syntax
  2844. ------
  2845.  
  2846.      #include <bios.h>
  2847.      
  2848.      unsigned _bios_disk(unsigned cmd, struct diskinfo_t *di)
  2849.  
  2850. Description
  2851. -----------
  2852.  
  2853. This function interfaces with the BIOS disk sevice (interrupt 0x13).
  2854. The parameter CMD select the corresponding disk service and the
  2855. structure DI holds the disk parameters.
  2856.  
  2857.      struct diskinfo_t {
  2858.        unsigned drive;       /* Drive number. */
  2859.        unsigned head;        /* Head number. */
  2860.        unsigned track;       /* Track number. */
  2861.        unsigned sector;      /* Sector number. */
  2862.        unsigned nsectors;    /* Number of sectors to read/write/verify. */
  2863.        void    *buffer;      /* Buffer for reading/writing/verifying. */
  2864.      }
  2865.  
  2866. The following services are available based on value of CMD:
  2867.  
  2868. `_DISK_RESET'
  2869.      Forces the disk controller to do a hard reset, preparing for
  2870.      floppy-disk I/O. This is useful after an error occurs in another
  2871.      operation, such as a read. If this service is specified, the DI
  2872.      argument is ignored. Status is returned in the 8 high-order bits
  2873.      (AH) of the return value. If there is an error, the high-order
  2874.      byte will contain a set of status flags, as defined below under
  2875.      Return Value.
  2876.  
  2877. `_DISK_STATUS'
  2878.      Obtains the status of the last disk operation. If this service is
  2879.      specified, the <diskinfo> argument is ignored. Status is returned
  2880.      in the 8 low-order bits (AL) of the return value. If there is an
  2881.      error, the low-order byte (AL) will contain a set of status flags,
  2882.      as defined below under Return Value.
  2883.  
  2884. `_DISK_READ'
  2885.      Reads one or more disk sectors into memory. This service uses all
  2886.      fields of the structure pointed to by DISKINFO. If no error
  2887.      occurs, the function returns 0 in the high-order byte and the
  2888.      number of sectors read in the low-order byte. If there is an
  2889.      error, the high-order byte (AH) will contain a set of status
  2890.      flags, as defined below under Return Value.
  2891.  
  2892. `_DISK_WRITE'
  2893.      Writes data from memory to one or more disk sectors. This service
  2894.      uses all fields of the structure pointed to by <diskinfo>. If no
  2895.      error occurs, the function returns 0 in the high-order byte (AH)
  2896.      and the number of sectors written in the low-order byte (AL). If
  2897.      there is an error, the high-order byte will contain a set of
  2898.      status flags, as defined below under Return Value.
  2899.  
  2900. `_DISK_FORMAT'
  2901.      Formats the track specified by DISKINFO. The HEAD and TRACK fields
  2902.      indicate the track to format. Only one track can be formatted in a
  2903.      single call. The BUFFER field points to a set of sector markers.
  2904.      The format of the markers depends on the type of disk drive (see a
  2905.      technical reference to the PC BIOS to determine the marker
  2906.      format). The high-order byte (AH) of the return value contains the
  2907.      status of the call; 0 equals success. If there is an error, the
  2908.      high-order byte will contain a set of status flags, as defined
  2909.      below under Return Value.
  2910.  
  2911. `_DISK_VERIFY'
  2912.      Checks the disk to be sure the specified sectors exist and can be
  2913.      read.  It also runs a CRC (cyclic redundancy check) test. This
  2914.      service uses all fields (except BUFFER) of the structure pointed
  2915.      to by DISKINFO.  If no error occurs, the function returns 0 in the
  2916.      high-order byte (AH) and the number of sectors compared in the
  2917.      low-order byte (AL), as defined below under Return Value.
  2918.  
  2919. Return Value
  2920. ------------
  2921.  
  2922. Return value of AX register. The meaning of high-order byte (AH):
  2923.      0x00  No error
  2924.      0x01  Invalid request or a bad command
  2925.      0x02  Address mark not found
  2926.      0x03  Disk write protected
  2927.      0x04  Sector not found
  2928.      0x05  Reset failed
  2929.      0x06  Floppy disk removed
  2930.      0x07  Drive parameter activity failed
  2931.      0x08  Direct Memory Access (DMA) overrun
  2932.      0x09  DMA crossed 64K boundary
  2933.      0x0A  Bad sector flag detected
  2934.      0x0B  Bad track flag detected
  2935.      0x0C  Media type not found
  2936.      0x0D  Invalid number of sectors on format
  2937.      0x0E  Control data access mark detected
  2938.      0x0F  DMA arbitration level out of range
  2939.      0x10  Data read (CRC or ECC) error
  2940.      0x11  Corrected data read (ECC) error
  2941.      0x20  Controller failure
  2942.      0x40  Seek error
  2943.      0x80  Disk timed out or failed to respond
  2944.      0xAA  Drive not ready
  2945.      0xBB  Undefined error
  2946.      0xCC  Write fault on drive
  2947.      0xE0  Status error
  2948.      0xFF  Sense operation failed
  2949.  
  2950. Portability
  2951. -----------
  2952.  
  2953. not ANSI, not POSIX
  2954.  
  2955. Example
  2956. -------
  2957.  
  2958.      char record_buffer[512];
  2959.      struct diskinfo_t di;
  2960.      
  2961.      di.drive    = 0x80;
  2962.      di.head     = 0;
  2963.      di.track    = 0;
  2964.      di.sector   = 0;
  2965.      di.nsectors = 1;
  2966.      di.buffer   = &record_buffer;
  2967.      if ( _bios_disk(_DISK_READ, &di) )
  2968.        puts("Disk error.");
  2969.  
  2970. 
  2971. File: libc.info,  Node: _bios_equiplist,  Next: _bios_keybrd,  Prev: _bios_disk,  Up: Alphabetical List
  2972.  
  2973. _bios_equiplist
  2974. ===============
  2975.  
  2976. Syntax
  2977. ------
  2978.  
  2979.      #include <bios.h>
  2980.      
  2981.      unsigned _bios_equiplist(void)
  2982.  
  2983. Description
  2984. -----------
  2985.  
  2986. This function returns the equipment word from BIOS request 0x11.  The
  2987. bits correspond to the following values:
  2988.  
  2989.      Bits  Meaning
  2990.      0     True (1) if disk drive(s) installed
  2991.      1     True (1) if math coprocessor installed
  2992.      2-3   System RAM in 16K blocks (16-64K)
  2993.      4-5   Initial video mode:
  2994.                 00 = Reserved
  2995.                 01 = 40 x 25 color
  2996.                 10 = 80 x 25 color
  2997.                 11 = 80 x 25 monochrome
  2998.      6-7   Number of floppy-disk drives installed
  2999.            (00 = 1, 01 = 2, etc.)
  3000.      8     False (0) if and only if a Direct Memory Access (DMA)
  3001.            chip is installed
  3002.      9-11  Number of RS232 serial ports installed
  3003.      12    True (1) if and only if a game adapter is installed
  3004.      13    True (1) if and only if an internal modem is installed
  3005.      14-15 Number of printers installed
  3006.  
  3007. Return Value
  3008. ------------
  3009.  
  3010. The equipment word.
  3011.  
  3012. Portability
  3013. -----------
  3014.  
  3015. not ANSI, not POSIX
  3016.  
  3017. Example
  3018. -------
  3019.  
  3020.      if ( _bios_equiplist() & 0xc000 )
  3021.        do_printing();
  3022.  
  3023. 
  3024. File: libc.info,  Node: _bios_keybrd,  Next: _bios_memsize,  Prev: _bios_equiplist,  Up: Alphabetical List
  3025.  
  3026. _bios_keybrd
  3027. ============
  3028.  
  3029. Syntax
  3030. ------
  3031.  
  3032.      #include <bios.h>
  3033.      
  3034.      unsigned _bios_keybrd(unsigned cmd);
  3035.  
  3036. Description
  3037. -----------
  3038.  
  3039. The _bios_keybrd routine uses INT 0x16 to access the keyboard services.
  3040. The CMD argument can be any of the following manifest constants:
  3041.  
  3042. `_KEYBRD_READ'
  3043.      Read the next key pressed
  3044.  
  3045. `_NKEYBRD_READ'
  3046.      Read the next extended key pressed
  3047.  
  3048. `_KEYBRD_READY'
  3049.      Check if the next key in the keyboard buffer
  3050.  
  3051. `_NKEYBRD_READY'
  3052.      Check if the next extended key in the keyboard buffer
  3053.  
  3054. `_KEYBRD_SHIFTSTATUS'
  3055.      Read keyboard shift state (0x0040:0x0017 byte):
  3056.  
  3057.           7654 3210  Meaning
  3058.           ---- ---X  Right SHIFT is pressed
  3059.           ---- --X-  Left SHIFT is pressed
  3060.           ---- -X--  CTRL is pressed
  3061.           ---- X---  ALT is pressed
  3062.           ---X ----  Scroll Lock locked
  3063.           --X- ----  Num Lock locked
  3064.           -X-- ----  Caps Lock locked
  3065.           X--- ----  Insert locked
  3066.  
  3067. `_NKEYBRD_SHIFTSTATUS'
  3068.      Read keyboard shift and extended shift state (0x0040:0x0017 word):
  3069.  
  3070.           FEDC BA98  7654 3210  Meaning
  3071.           ---- ----  ---- ---X  Right SHIFT is pressed
  3072.           ---- ----  ---- --X-  Left SHIFT is pressed
  3073.           ---- ----  ---- -X--  CTRL is pressed
  3074.           ---- ----  ---- X---  ALT is pressed
  3075.           ---- ----  ---X ----  Scroll Lock locked
  3076.           ---- ----  --X- ----  Num Lock locked
  3077.           ---- ----  -X-- ----  Caps Lock locked
  3078.           ---- ----  X--- ----  Insert locked
  3079.           
  3080.           ---- ---X  ---- ----  Left CTRL is pressed
  3081.           ---- --X-  ---- ----  Left ALT is pressed
  3082.           ---- -X--  ---- ----  Right CTRL is pressed
  3083.           ---- X---  ---- ----  Right ALT is pressed
  3084.           ---X ----  ---- ----  Scroll Lock is pressed
  3085.           --X- ----  ---- ----  Num Lock is pressed
  3086.           -X-- ----  ---- ----  Caps Lock is pressed
  3087.           X--- ----  ---- ----  SysReq is pressed
  3088.  
  3089. Return Value
  3090.  
  3091. With the ???_READ and ???_SHIFTSTATUS arguments, the _bios_keybrd
  3092. function returns the contents of the AX register after the BIOS call.
  3093.  
  3094. With the ???_READY argument, _bios_keybrd returns 0 if there is no key.
  3095. If there is a key, _bios_keybrd returns the key waiting to be read
  3096. (that is, the same value as _KEYBRD_READ).
  3097.  
  3098. With the ???_READ and ???_READY arguments, the _bios_keybrd function
  3099. returns -1 if CTRL+BREAK has been pressed and is the next keystroke to
  3100. be read.
  3101.  
  3102. Portability
  3103. -----------
  3104.  
  3105. not ANSI, not POSIX
  3106.  
  3107. Example
  3108. -------
  3109.  
  3110.      while( !_bios_keybrd(_KEYBRD_READY) )
  3111.        try_to_do_something();
  3112.  
  3113. 
  3114. File: libc.info,  Node: _bios_memsize,  Next: _bios_printer,  Prev: _bios_keybrd,  Up: Alphabetical List
  3115.  
  3116. _bios_memsize
  3117. =============
  3118.  
  3119. Syntax
  3120. ------
  3121.  
  3122.      #include <bios.h>
  3123.      
  3124.      unsigned _bios_memsize(void);
  3125.  
  3126. Description
  3127. -----------
  3128.  
  3129. This function returns the amount of system memory in 1K blocks (up to
  3130. 640K).
  3131.  
  3132. Return Value
  3133. ------------
  3134.  
  3135. Size of memory (in K).
  3136.  
  3137. Portability
  3138. -----------
  3139.  
  3140. not ANSI, not POSIX
  3141.  
  3142. Example
  3143. -------
  3144.  
  3145.      printf("This system has %d bytes of memory\n", _bios_memsize() * 1024);
  3146.  
  3147. 
  3148. File: libc.info,  Node: _bios_printer,  Next: _bios_serialcom,  Prev: _bios_memsize,  Up: Alphabetical List
  3149.  
  3150. _bios_printer
  3151. =============
  3152.  
  3153. Syntax
  3154. ------
  3155.  
  3156.      #include <bios.h>
  3157.      
  3158.      unsigned _bios_printer(unsigned cmd, unsigned printer, unsigned data);
  3159.  
  3160. Description
  3161. -----------
  3162.  
  3163. The _bios_printer routine uses INT 0x17 to perform printer output
  3164. services for parallel printers. The PRINTER argument specifies the
  3165. affected printer, where 0 is LPT1, 1 is LPT2, and so on.  The CMD
  3166. argument can be any of the following manifest constants:
  3167.  
  3168. `_PRINTER_INIT'
  3169.  
  3170. `Reset and initialize the specified printer port'
  3171.  
  3172. `_PRINTER_STATUS'
  3173.      Return the status of the specified printer port
  3174.  
  3175. `_PRINTER_WRITE'
  3176.      Print the DATA argument to the specified printer port
  3177.  
  3178. Return Value
  3179. ------------
  3180.  
  3181. The _bios_printer function returns the value in the AX register after
  3182. the BIOS interrupt. The high-order byte (AH) of the return value
  3183. indicates the printer status after the operation, as defined below:
  3184.  
  3185.      Bit     Meaning if True
  3186.      
  3187.      0       Printer timed out
  3188.      1       Not used
  3189.      2       Not used
  3190.      3       I/O error
  3191.      4       Printer selected
  3192.      5       Out of paper
  3193.      6       Acknowledge
  3194.      7       Printer not busy
  3195.  
  3196. Portability
  3197. -----------
  3198.  
  3199. not ANSI, not POSIX
  3200.  
  3201. Example
  3202. -------
  3203.  
  3204.      while (*c)
  3205.        _bios_printer(_PRINTER_WRITE, *c++, 0);
  3206.  
  3207. 
  3208. File: libc.info,  Node: _bios_serialcom,  Next: _bios_timeofday,  Prev: _bios_printer,  Up: Alphabetical List
  3209.  
  3210. _bios_serialcom
  3211. ===============
  3212.  
  3213. Syntax
  3214. ------
  3215.  
  3216.      #include <bios.h>
  3217.      
  3218.      unsigned _bios_serialcom(unsigned cmd, unsingned serialport, unsigned data);
  3219.  
  3220. Description
  3221. -----------
  3222.  
  3223. The _bios_serialcom routine uses INT 0x14 to provide serial
  3224. communications services. The SERIALPORT argument is set to 0 for COM1,
  3225. to 1 for COM2, and so on. The CMD argument can be set to one of the
  3226. following manifest constants:
  3227.  
  3228. `_COM_INIT'
  3229.      Initialize com port (DATA is the settings)
  3230.  
  3231. `_COM_RECEIVE'
  3232.      Read a byte from port
  3233.  
  3234. `_COM_SEND'
  3235.      Write a byte to port
  3236.  
  3237. `_COM_STATUS'
  3238.      Get the port status
  3239.  
  3240. The DATA argument is ignored if CMD is set to _COM_RECEIVE or
  3241. _COM_STATUS. The DATA argument for _COM_INIT is created by combining
  3242. one or more of the following constants (with the OR operator):
  3243.  
  3244.      _COM_CHR7         7 bits/character
  3245.      _COM_CHR8         8 bits/character
  3246.      _COM_STOP1        1 stop bit
  3247.      _COM_STOP2        2 stop bits
  3248.      _COM_NOPARITY     no parity
  3249.      _COM_EVENPARITY   even parity
  3250.      _COM_ODDPARITY    odd parity
  3251.      _COM_110          110 baud
  3252.      _COM_150          150 baud
  3253.      _COM_300          300 baud
  3254.      _COM_600          600 baud
  3255.      _COM_1200         1200 baud
  3256.      _COM_2400         2400 baud
  3257.      _COM_4800         4800 baud
  3258.      _COM_9600         9600 baud
  3259.  
  3260. The default value of DATA is 1 stop bit, no parity, and 110 baud.
  3261.  
  3262. Return Value
  3263. ------------
  3264.  
  3265. The function returns a 16-bit integer whose high-order byte contains
  3266. status bits. The meaning of the low-order byte varies, depending on the
  3267. CMD value. The high-order bits are as follows:
  3268.  
  3269.      Bit     Meaning if Set
  3270.      
  3271.      15      Timed out
  3272.      14      Transmission-shift register empty
  3273.      13      Transmission-hold register empty
  3274.      12      Break detected
  3275.      11      Framing error
  3276.      10      Parity error
  3277.       9      Overrun error
  3278.       8      Data ready
  3279.  
  3280. When service is _COM_SEND, bit 15 is set if data cannot be sent.
  3281.  
  3282. When service is _COM_RECEIVE, the byte read is returned in the
  3283. low-order bits if the call is successful. If an error occurs, any of
  3284. the bits 9, 10, 11, or 15 is set.
  3285.  
  3286. When service is _COM_INIT or _COM_STATUS, the low-order bits are
  3287. defined as follows:
  3288.  
  3289.      Bit     Meaning if Set
  3290.      
  3291.      7       Receive-line signal detected
  3292.      6       Ring indicator
  3293.      5       Data-set-ready
  3294.      4       Clear-to-send
  3295.      3       Change in receive-line signal detected
  3296.      2       Trailing-edge ring indicator
  3297.      1       Change in data-set-ready status
  3298.      0       Change in clear-to-send status
  3299.  
  3300. Portability
  3301. -----------
  3302.  
  3303. not ANSI, not POSIX
  3304.  
  3305. Example
  3306. -------
  3307.  
  3308.      /* 9600 baud, no parity, one stop, 8 bits */
  3309.      _bios_serialcom(_COM_INIT, 0, _COM_9600|_COM_NOPARITY|_COM_STOP1|_COM_CHR8);
  3310.      for(i=0; buf[i]; i++)
  3311.        _bios_serialcom(_COM_SEND, 0, buf[i]);
  3312.  
  3313. 
  3314. File: libc.info,  Node: _bios_timeofday,  Next: bioscom,  Prev: _bios_serialcom,  Up: Alphabetical List
  3315.  
  3316. _bios_timeofday
  3317. ===============
  3318.  
  3319. Syntax
  3320. ------
  3321.  
  3322.      #include <bios.h>
  3323.      
  3324.      unsigned _bios_timeofday(unsigned cmd, unsigned long *timeval);
  3325.  
  3326. Description
  3327. -----------
  3328.  
  3329. The _bios_timeofday routine uses INT 0x1A to get or set the clock count
  3330. (which is the number of 18.2 Hz ticks since midnight). The CMD argument
  3331. can be either the _TIME_GETCLOCK or _TIME_SETCLOCK manifest constant.
  3332.  
  3333. Return Value
  3334. ------------
  3335.  
  3336. If the argument is _TIME_GETCLOCK, the routine returns a nonzero value
  3337. if midnight was passed since last read, or zero if midnight was not
  3338. passed. If the argument is _TIME_SETCLOCK, the return value is
  3339. undefined.
  3340.  
  3341. Portability
  3342. -----------
  3343.  
  3344. not ANSI, not POSIX
  3345.  
  3346. Example
  3347. -------
  3348.  
  3349.      unsigned hour, min, sec, hsec;
  3350.      unsigned long ticks;
  3351.      ...
  3352.      ticks = (unsigned long)(hour * 65543.33) + (min * 1092.38) +
  3353.              (sec * 18.21) + (hsec * 0.182);
  3354.      _bios_timeofday(_TIME_SETCLOCK, &ticks);
  3355.  
  3356. 
  3357. File: libc.info,  Node: bioscom,  Next: biosdisk,  Prev: _bios_timeofday,  Up: Alphabetical List
  3358.  
  3359. bioscom
  3360. =======
  3361.  
  3362. Syntax
  3363. ------
  3364.  
  3365.      #include <bios.h>
  3366.      
  3367.      int bioscom(int cmd, char data, int port);
  3368.  
  3369. Description
  3370. -----------
  3371.  
  3372. This function accesses the BIOS interrupt 0x14 function, serial
  3373. communication services.  `port' should be the COM port (0=COM1, 1=COM2,
  3374. etc).
  3375.  
  3376. The valid values of cmd are:
  3377.  
  3378. 0 - initialize com port (DATA is the settings)
  3379.  
  3380. 1 - write byte to port
  3381.  
  3382. 2 - read byte from port (DATA is ignored)
  3383.  
  3384. 3 - get port status
  3385.  
  3386. For initialization, the byte is made up of the following bits:
  3387.  
  3388.      0000 0000
  3389.      7654 3210  Meaning
  3390.      
  3391.      ---- --10  7 bits/character
  3392.      ---- --11  8 bits/character
  3393.      ---- -0--  1 stop bit
  3394.      ---- -1--  2 stop bits
  3395.      ---X 0---  no parity
  3396.      ---0 1---  odd parity
  3397.      ---1 1---  even parity
  3398.      000- ----  110 baud
  3399.      001- ----  150 baud
  3400.      010- ----  300 baud
  3401.      011- ----  600 baud
  3402.      100- ----  1200 baud
  3403.      101- ----  2400 baud
  3404.      110- ----  4800 baud
  3405.      111- ----  9600 baud
  3406.  
  3407. For writing a character out to the port, the return value's lower 8
  3408. bits contain the same byte as passed as the DATA argument.
  3409.  
  3410. For reading a character from the port, the value of DATA is ignored,
  3411. and the lower 8 bits of the return value contain the byte read.  Also,
  3412. the "timeout" bit in the upper 8 bits is used as an error indicator in
  3413. this case (0=success, 1=error).  If it indicates an error, you should
  3414. call the "get port status" variant to get the detailed error bits.
  3415.  
  3416. Return Value
  3417. ------------
  3418.  
  3419. The return value is a sequence of bits that indicate the port status
  3420. and, for cmd=0 and 3, the modem status.  For read/write operations, the
  3421. lower eight bits are the character read.
  3422.  
  3423.      1111 1100 0000 0000
  3424.      5432 1098 7654 3210  Meaning
  3425.      
  3426.      ---- ---- ---- ---1  CTS change
  3427.      ---- ---- ---- --1-  DSR change
  3428.      ---- ---- ---- -1--  ring change
  3429.      ---- ---- ---- 1---  carrier detect change
  3430.      ---- ---- ---1 ----  CTS present
  3431.      ---- ---- --1- ----  DSR present
  3432.      ---- ---- -1-- ----  ring present
  3433.      ---- ---- 1--- ----  carrier detect
  3434.      ---- ---1 ---- ----  data ready
  3435.      ---- --1- ---- ----  overrun error
  3436.      ---- -1-- ---- ----  parity error
  3437.      ---- 1--- ---- ----  framing error
  3438.      ---1 ---- ---- ----  break detected
  3439.      --1- ---- ---- ----  transmit holding register empty
  3440.      -1-- ---- ---- ----  transmit shift register empty
  3441.      1--- ---- ---- ----  time out (=1 if error present for cmd=1,2)
  3442.  
  3443. Portability
  3444. -----------
  3445.  
  3446. not ANSI, not POSIX
  3447.  
  3448. Example
  3449. -------
  3450.  
  3451.      bioscom(0, 0xe3, 0); /* 9600 baud, no parity, one stop, 8 bits */
  3452.      for (i=0; buf[i]; i++)
  3453.        bioscom(1, buf[i], 0);
  3454.  
  3455. 
  3456. File: libc.info,  Node: biosdisk,  Next: biosequip,  Prev: bioscom,  Up: Alphabetical List
  3457.  
  3458. biosdisk
  3459. ========
  3460.  
  3461. Syntax
  3462. ------
  3463.  
  3464.      #include <bios.h>
  3465.      
  3466.      int biosdisk(int cmd, int drive, int head, int track,
  3467.               int sector, int nsects, void *buffer);
  3468.  
  3469. Description
  3470. -----------
  3471.  
  3472. This function interfaces with the BIOS disk service (interrupt 0x13).
  3473. Please refer to a BIOS reference manual for detailed information about
  3474. the parameters of this call.  The function assumes a sector size of 512
  3475. bytes.
  3476.  
  3477. The following functions of Int 13h are currently supported:
  3478.  
  3479. 0 - reset disk subsystem
  3480.  
  3481. 1 - get status of last operation (see *Note _bios_disk::, for possible values)
  3482.  
  3483. 2 - read one or more sectors
  3484.  
  3485. 3 - write one or more sectors
  3486.  
  3487. 5 - format a track
  3488.  
  3489. 6 - format a cylinder and set bad sector flag
  3490.  
  3491. 7 - format drive from specified cylinder
  3492.  
  3493. 8 - get drive parameters
  3494.  
  3495. 9 - initialize drive parameters
  3496.  
  3497. 10 - read long sectors
  3498.  
  3499. 11 - write long sectors
  3500.  
  3501. 12 - seek to cylinder
  3502.  
  3503. 13 - alternate fixed disk reset
  3504.  
  3505. 14 - read sector buffer
  3506.  
  3507. 15 - write sector buffer
  3508.  
  3509. 16 - test for drive ready
  3510.  
  3511. 17 - recalibrate drive
  3512.  
  3513. 18 - controller RAM diagnostic
  3514.  
  3515. 19 - controller drive diagnostic
  3516.  
  3517. 20 - controller internal diagnostic
  3518.  
  3519. 21 - get DASD type
  3520.  
  3521. 22 - read disk change line status
  3522.  
  3523. 23 - set DASD type (pass DASD code in NSECTS)
  3524.  
  3525. 24 - set media type for format
  3526. The first request with more sectors than will fit in the transfer
  3527. buffer will cause a DOS buffer to be allocated.  This buffer is
  3528. automatically freed when your application exits.  Requests for more
  3529. sectors than 18 sectors (9K) will fail.
  3530.  
  3531. Function 8 returns values in BUFFER as follows:
  3532.  
  3533. byte 0 = sectors per track (bits 0..5), top two bits of cylinder (in bits 6..7)
  3534.  
  3535. byte 1 = cylinders (bits 0..7)
  3536.  
  3537. byte 2 = number of drives
  3538.  
  3539. byte 3 = number of heads
  3540. Return Value
  3541. ------------
  3542.  
  3543. The value of AH returned by the BIOS.  See *Note _bios_disk::, for a
  3544. detailed list of possible status and error codes.
  3545.  
  3546. Portability
  3547. -----------
  3548.  
  3549. not ANSI, not POSIX
  3550.  
  3551. Example
  3552. -------
  3553.  
  3554.      char buffer[512];
  3555.      if (biosdisk(2, 0x80, 0, 0, 0, 1, buffer))
  3556.        error("disk");
  3557.  
  3558. 
  3559. File: libc.info,  Node: biosequip,  Next: bioskey,  Prev: biosdisk,  Up: Alphabetical List
  3560.  
  3561. biosequip
  3562. =========
  3563.  
  3564. Syntax
  3565. ------
  3566.  
  3567.      #include <bios.h>
  3568.      
  3569.      int biosequip(void);
  3570.  
  3571. Description
  3572. -----------
  3573.  
  3574. This function returns the equipment word from BIOS request 0x11.  The
  3575. bits correspond to the following values:
  3576.  
  3577.      1111 1100 0000 0000
  3578.      5432 1098 7654 3210  Meaning
  3579.      
  3580.      ---- ---- ---- ---X  1 = disk drive(s) installed
  3581.      ---- ---- ---- --X-  1 = math coprocessor installed
  3582.      ---- ---- ---- XX--  System memory 00=16k 01=32k 10=48k 11=64k (non PS/2)
  3583.      ---- ---- ---- -X--  1 = pointing device installed (PS/2)
  3584.      ---- ---- ---- X---  not used on PS/2
  3585.      ---- ---- --XX ----  initial video mode: 01=CO40 10=CO80 11=MONO
  3586.      ---- ---- XX-- ----  disk drives 00=1 01=2 10=3 11=4 (zero if bit 1=0)
  3587.      ---- ---X ---- ----  1 = no DMA available
  3588.      ---- XXX- ---- ----  number of serial ports installed (000=0 001=1 etc)
  3589.      ---X ---- ---- ----  1 = game port adapter installed
  3590.      --X- ---- ---- ----  1 = internal modem installed (PS/2)
  3591.      --X- ---- ---- ----  1 = serial printer attached (non PS/2)
  3592.      XX-- ---- ---- ----  number of printers installed (00=0 01=1 10=2 11=3)
  3593.  
  3594. Return Value
  3595. ------------
  3596.  
  3597. The equipment word.
  3598.  
  3599. Portability
  3600. -----------
  3601.  
  3602. not ANSI, not POSIX
  3603.  
  3604. Example
  3605. -------
  3606.  
  3607.      if (biosequip() & 0xc000)
  3608.        do_printing();
  3609.  
  3610. 
  3611. File: libc.info,  Node: bioskey,  Next: biosmemory,  Prev: biosequip,  Up: Alphabetical List
  3612.  
  3613. bioskey
  3614. =======
  3615.  
  3616. Syntax
  3617. ------
  3618.  
  3619.      #include <bios.h>
  3620.      
  3621.      int bioskey(int command)
  3622.  
  3623. Description
  3624. -----------
  3625.  
  3626. This function issues the BIOS keyboard interrupt 16h with COMMAND in
  3627. the AH register, and returns the results of that call.  The argument
  3628. COMMAND can accept the following values:
  3629.  
  3630. COMMAND = 0
  3631.      Returns the next key pressed.  The value returned is a combination
  3632.      of the key's scan code in the high 8 bits and its ASCII code in
  3633.      the low 8 bits.
  3634.  
  3635. COMMAND = 1
  3636.      Checks the keyboard, returns zero if no key pressed, else the key.
  3637.      Does not dequeue the key from the keyboard buffer.  The value
  3638.      returned when a key was pressed is a combination of the key's scan
  3639.      code in the high 8 bits and its ASCII code in the low 8 bits.
  3640.  
  3641.      If the `Ctrl-<BREAK>' key was pressed, returns -1.
  3642.  
  3643. COMMAND = 2
  3644.      Returns the shift state:
  3645.  
  3646.           7654 3210  Meaning
  3647.           
  3648.           ---- ---X  Right shift key down
  3649.           ---- --X-  Left shift key down
  3650.           ---- -X--  Ctrl key down
  3651.           ---- X---  Alt key down
  3652.           ---X ----  Scroll lock on
  3653.           --X- ----  Num lock on
  3654.           -X-- ----  Caps lock on
  3655.           X--- ----  Insert on
  3656.  
  3657. COMMAND = 10
  3658.      Returns the next extended key pressed.  This works like the case of
  3659.      COMMAND = 0, but it recognizes additional keys from the AT-style
  3660.      extended 101-key keyboard, like the second <Alt> key and <F12>.
  3661.      If a key was pressed, returns the scan code and ASCII code packed
  3662.      in same way as for COMMAND = 0.
  3663.  
  3664.      Almost every PC nowadays has an extended 101-key keyboard.
  3665.  
  3666. COMMAND = 11
  3667.      Like the case of COMMAND = 1, but recognizes the additional keys
  3668.      of the extended keyboard.
  3669.  
  3670. COMMAND = 12
  3671.      Returns the two status bytes of the enhanced keyboard, packed in
  3672.      the low 16 bits of the return value.  The individual bits of the
  3673.      return value are defined in the following table:
  3674.  
  3675.           FEDC BA98  7654 3210  Meaning
  3676.           ---- ----  ---- ---X  Right SHIFT is pressed
  3677.           ---- ----  ---- --X-  Left SHIFT is pressed
  3678.           ---- ----  ---- -X--  CTRL is pressed
  3679.           ---- ----  ---- X---  ALT is pressed
  3680.           ---- ----  ---X ----  Scroll Lock locked
  3681.           ---- ----  --X- ----  Num Lock locked
  3682.           ---- ----  -X-- ----  Caps Lock locked
  3683.           ---- ----  X--- ----  Insert locked
  3684.           
  3685.           ---- ---X  ---- ----  Left CTRL is pressed
  3686.           ---- --X-  ---- ----  Left ALT is pressed
  3687.           ---- -X--  ---- ----  Right CTRL is pressed
  3688.           ---- X---  ---- ----  Right ALT is pressed
  3689.           ---X ----  ---- ----  Scroll Lock is pressed
  3690.           --X- ----  ---- ----  Num Lock is pressed
  3691.           -X-- ----  ---- ----  Caps Lock is pressed
  3692.           X--- ----  ---- ----  SysReq is pressed
  3693.  
  3694. Return Value
  3695. ------------
  3696.  
  3697. Depends on COMMAND.
  3698.  
  3699. Portability
  3700. -----------
  3701.  
  3702. not ANSI, not POSIX
  3703.  
  3704. Example
  3705. -------
  3706.  
  3707.      while (!bioskey(1))
  3708.        do_stuff();
  3709.  
  3710. 
  3711. File: libc.info,  Node: biosmemory,  Next: biosprint,  Prev: bioskey,  Up: Alphabetical List
  3712.  
  3713. biosmemory
  3714. ==========
  3715.  
  3716. Syntax
  3717. ------
  3718.  
  3719.      #include <bios.h>
  3720.      
  3721.      unsigned biosmemory(void);
  3722.  
  3723. Description
  3724. -----------
  3725.  
  3726. This function returns the amount of system memory in 1k blocks.
  3727.  
  3728. Note that this function doesn't know about extended memory above the
  3729. 640K mark, so it will report 640K at most.  This is a limitation of the
  3730. BIOS.
  3731.  
  3732. Return Value
  3733. ------------
  3734.  
  3735. Bytes of memory / 1024.
  3736.  
  3737. Portability
  3738. -----------
  3739.  
  3740. not ANSI, not POSIX
  3741.  
  3742. Example
  3743. -------
  3744.  
  3745.      printf("This system has %d bytes of memory\n", biosmemory()*1024);
  3746.  
  3747. 
  3748. File: libc.info,  Node: biosprint,  Next: biostime,  Prev: biosmemory,  Up: Alphabetical List
  3749.  
  3750. biosprint
  3751. =========
  3752.  
  3753. Syntax
  3754. ------
  3755.  
  3756.      #include <bios.h>
  3757.      
  3758.      int biosprint(int cmd, int byte, int port)
  3759.  
  3760. Description
  3761. -----------
  3762.  
  3763. COMMAND = 0
  3764.      `byte' is sent to parallel port PORT.
  3765.  
  3766. COMMAND = 1
  3767.      Parallel port PORT is reset and initialized.
  3768.  
  3769. COMMAND = 2
  3770.      The status of parallel port PORT is returned.
  3771.  
  3772.           7654 3210  Meaning
  3773.           
  3774.           ---- ---X  Timeout
  3775.           ---- -XX-  Unused
  3776.           ---- X---  I/O Error
  3777.           ---X ----  Selected
  3778.           --X- ----  Out of paper
  3779.           -X-- ----  Acknowledged
  3780.           X--- ----  Idle
  3781.  
  3782. Return Value
  3783. ------------
  3784.  
  3785. The printer status.
  3786.  
  3787. Portability
  3788. -----------
  3789.  
  3790. not ANSI, not POSIX
  3791.  
  3792. Example
  3793. -------
  3794.  
  3795.      while (*c)
  3796.        biosprint(0, *c++, 0);
  3797.  
  3798. 
  3799. File: libc.info,  Node: biostime,  Next: blinkvideo,  Prev: biosprint,  Up: Alphabetical List
  3800.  
  3801. biostime
  3802. ========
  3803.  
  3804. Syntax
  3805. ------
  3806.  
  3807.      #include <bios.h>
  3808.      
  3809.      long biostime(int cmd, long newtime);
  3810.  
  3811. Description
  3812. -----------
  3813.  
  3814. This function reads (CMD=0) or sets (CMD=1) the internal tick counter,
  3815. which is the number of 18.2 Hz ticks since midnight.
  3816.  
  3817. Return Value
  3818. ------------
  3819.  
  3820. When reading, the number of ticks since midnight.
  3821.  
  3822. Portability
  3823. -----------
  3824.  
  3825. not ANSI, not POSIX
  3826.  
  3827. Example
  3828. -------
  3829.  
  3830.      long ticks = biostime(0, 0);
  3831.  
  3832. 
  3833. File: libc.info,  Node: blinkvideo,  Next: brk,  Prev: biostime,  Up: Alphabetical List
  3834.  
  3835. blinkvideo
  3836. ==========
  3837.  
  3838. Syntax
  3839. ------
  3840.  
  3841.      #include <conio.h>
  3842.      
  3843.      void blinkvideo(void);
  3844.  
  3845. Description
  3846. -----------
  3847.  
  3848. Bit 7 (`MSB') of the character attribute byte has two possible effects
  3849. on EGA and VGA displays: it can either make the character blink or
  3850. change the background color to bright (thus allowing for 16 background
  3851. colors as opposed to the usual 8).  This function sets that bit to
  3852. display blinking characters.  After a call to this function, every
  3853. character written to the screen with bit 7 of the attribute byte set,
  3854. will blink.  The companion function `intensevideo' (*note
  3855. intensevideo::.) has the opposite effect.
  3856.  
  3857. Note that there is no BIOS function to get the current status of this
  3858. bit, but bit 5 of the byte at `0040h:0065h' in the BIOS area indicates
  3859. the current state: if it's 1 (the default), blinking characters will be
  3860. displayed.
  3861.  
  3862. Portability
  3863. -----------
  3864.  
  3865. not ANSI, not POSIX
  3866.  
  3867. 
  3868. File: libc.info,  Node: brk,  Next: bsearch,  Prev: blinkvideo,  Up: Alphabetical List
  3869.  
  3870. brk
  3871. ===
  3872.  
  3873. Syntax
  3874. ------
  3875.  
  3876.      #include <unistd.h>
  3877.      
  3878.      int brk(void *ptr);
  3879.  
  3880. Description
  3881. -----------
  3882.  
  3883. This function changes the *break* for the program.  This is the first
  3884. address that, if referenced, will cause a fault to occur.  The program
  3885. asks for more memory by specifying larger values for PTR.  Normally,
  3886. this is done transparently through the `malloc' function.
  3887.  
  3888. Return Value
  3889. ------------
  3890.  
  3891. Zero if the break was changed, -1 if not.  ERRNO is set to the error.
  3892.  
  3893. Portability
  3894. -----------
  3895.  
  3896. not ANSI, not POSIX
  3897.  
  3898. Example
  3899. -------
  3900.  
  3901.      if (brk(old_brk+1000))
  3902.        printf("no memory\n");
  3903.  
  3904. 
  3905. File: libc.info,  Node: bsearch,  Next: bzero,  Prev: brk,  Up: Alphabetical List
  3906.  
  3907. bsearch
  3908. =======
  3909.  
  3910. Syntax
  3911. ------
  3912.  
  3913.      #include <stdlib.h>
  3914.      
  3915.      void *bsearch (const void *key, const void *base, size_t num,
  3916.        size_t size, int (*ptf)(const void *ckey, const void *celem));
  3917.  
  3918. Description
  3919. -----------
  3920.  
  3921. Given an array of values, perform a binary search on the values looking
  3922. for value that "matches" the given key.  A match is determined by
  3923. calling the provided function PTF and passing it the key as CKEY and a
  3924. pointer to one of the elements of the array as CELEM.  This function
  3925. must return a negative number if the key is closer than the element to
  3926. the beginning of the array, positive if it is closer to the end, and
  3927. zero if the element matches the key.
  3928.  
  3929. The array begins at address BASE and contains NUM elements, each of
  3930. size SIZE.
  3931.  
  3932. Return Value
  3933. ------------
  3934.  
  3935. Returns a pointer to the element that matches the key, else NULL.
  3936.  
  3937. Portability
  3938. -----------
  3939.  
  3940. ANSI, POSIX
  3941.  
  3942. Example
  3943. -------
  3944.  
  3945.      typedef struct {
  3946.        int a, b;
  3947.      } q;
  3948.      
  3949.      int compare(void *key, void *elem)
  3950.      {
  3951.        return *(int *)key - ((q *)elem)->a;
  3952.      }
  3953.      
  3954.      q qlist[100];
  3955.      
  3956.      ...
  3957.      q *match = bsearch(4, qlist, 100, sizeof(q), compare);
  3958.      printf("4->%d=n", match->b);
  3959.      ...
  3960.  
  3961. 
  3962. File: libc.info,  Node: bzero,  Next: calloc,  Prev: bsearch,  Up: Alphabetical List
  3963.  
  3964. bzero
  3965. =====
  3966.  
  3967. Syntax
  3968. ------
  3969.  
  3970.      #include <string.h>
  3971.      
  3972.      void bzero(void *pointer, int length);
  3973.  
  3974. Description
  3975. -----------
  3976.  
  3977. The data at POINTER is filled with LENGTH zeros.
  3978.  
  3979. Return Value
  3980. ------------
  3981.  
  3982. None.
  3983.  
  3984. Portability
  3985. -----------
  3986.  
  3987. not ANSI, not POSIX
  3988.  
  3989. Example
  3990. -------
  3991.  
  3992.      char foo[100];
  3993.      bzero(foo,100);
  3994.  
  3995. 
  3996. File: libc.info,  Node: calloc,  Next: cbrt,  Prev: bzero,  Up: Alphabetical List
  3997.  
  3998. calloc
  3999. ======
  4000.  
  4001. Syntax
  4002. ------
  4003.  
  4004.      #include <stdlib.h>
  4005.      
  4006.      void *calloc(size_t num_elements, size_t size);
  4007.  
  4008. Description
  4009. -----------
  4010.  
  4011. This function allocates enough memory for NUM_ELEMENTS objects of size
  4012. SIZE.  The memory returned is initialized to all zeros.  The pointer
  4013. returned should later be passed to free (*note free::.) so that the
  4014. memory can be returned to the heap.
  4015.  
  4016. You may use cfree (*note xfree::.) to free the pointer also; it just
  4017. calls free.
  4018.  
  4019. Return Value
  4020. ------------
  4021.  
  4022. A pointer to the memory, or `NULL' if no more memory is available.
  4023.  
  4024. Portability
  4025. -----------
  4026.  
  4027. ANSI, POSIX
  4028.  
  4029. Example
  4030. -------
  4031.  
  4032.      Complex *x = calloc(12, sizeof(Complex));
  4033.      cfree(x);
  4034.  
  4035. 
  4036. File: libc.info,  Node: cbrt,  Next: ceil,  Prev: calloc,  Up: Alphabetical List
  4037.  
  4038. cbrt
  4039. ====
  4040.  
  4041. Syntax
  4042. ------
  4043.  
  4044.      #include <math.h>
  4045.      
  4046.      double cbrt(double x);
  4047.  
  4048. Description
  4049. -----------
  4050.  
  4051. This function computes the cube root of X.  It is faster and more
  4052. accurate to call `cbrt(X)' than to call `pow(X, 1./3.)'.
  4053.  
  4054. Return Value
  4055. ------------
  4056.  
  4057. The cube root of X.  If the value of X is `NaN', the return value is
  4058. `NaN' and `errno' is set to `EDOM'.  Infinite arguments are returned
  4059. unchanged, without setting `errno'.
  4060.  
  4061. Portability
  4062. -----------
  4063.  
  4064. not ANSI, not POSIX
  4065.  
  4066. 
  4067. File: libc.info,  Node: ceil,  Next: cfgetispeed,  Prev: cbrt,  Up: Alphabetical List
  4068.  
  4069. ceil
  4070. ====
  4071.  
  4072. Syntax
  4073. ------
  4074.  
  4075.      #include <math.h>
  4076.      
  4077.      double ceil(double x);
  4078.  
  4079. Description
  4080. -----------
  4081.  
  4082. This function computes the smallest integer greater than or equal to X.
  4083.  
  4084. Return Value
  4085. ------------
  4086.  
  4087. The smallest integer value greater than or equal to X.
  4088.  
  4089. Portability
  4090. -----------
  4091.  
  4092. ANSI, POSIX
  4093.  
  4094. 
  4095. File: libc.info,  Node: cfgetispeed,  Next: cfgetospeed,  Prev: ceil,  Up: Alphabetical List
  4096.  
  4097. cfgetispeed
  4098. ===========
  4099.  
  4100. Syntax
  4101. ------
  4102.  
  4103.      #include <termios.h>
  4104.      
  4105.      speed_t cfgetispeed (const struct termios *termiosp);
  4106.  
  4107. Description
  4108. -----------
  4109.  
  4110. This function gets the input line speed stored in the structure
  4111. TERMIOSP.  *Note Termios functions::, for more details about this
  4112. structure and the baudrate values it supports.
  4113.  
  4114. Note that the termios emulation handles console only, and that the input
  4115. baudrate value is ignored by this implementation.
  4116.  
  4117. Return Value
  4118. ------------
  4119.  
  4120. The input line speed on success, (speed_t) -1 for error.
  4121.  
  4122. Portability
  4123. -----------
  4124.  
  4125. not ANSI, POSIX
  4126.  
  4127. 
  4128. File: libc.info,  Node: cfgetospeed,  Next: cfmakeraw,  Prev: cfgetispeed,  Up: Alphabetical List
  4129.  
  4130. cfgetospeed
  4131. ===========
  4132.  
  4133. Syntax
  4134. ------
  4135.  
  4136.      #include <termios.h>
  4137.      
  4138.      speed_t cfgetospeed (const struct termios *termiosp);
  4139.  
  4140. Description
  4141. -----------
  4142.  
  4143. This function gets the output line speed stored in the structure
  4144. TERMIOSP.  *Note Termios functions::, for more details about this
  4145. structure and the baudrate values it supports.
  4146.  
  4147. Note that the termios emulation handles console only, and that the
  4148. baudrate value has no effect in this implementation.
  4149.  
  4150. Return Value
  4151. ------------
  4152.  
  4153. The output line speed on success, (speed_t) -1 for error.
  4154.  
  4155. Portability
  4156. -----------
  4157.  
  4158. not ANSI, POSIX
  4159.  
  4160. 
  4161. File: libc.info,  Node: cfmakeraw,  Next: cfree,  Prev: cfgetospeed,  Up: Alphabetical List
  4162.  
  4163. cfmakeraw
  4164. =========
  4165.  
  4166. Syntax
  4167. ------
  4168.  
  4169.      #include <termios.h>
  4170.      
  4171.      void cfmakeraw (struct termios *termiosp);
  4172.  
  4173. Description
  4174. -----------
  4175.  
  4176. This function sets the structure specified by TERMIOSP for raw mode.
  4177. It is provided for compatibility only.  Note that the termios emulation
  4178. handles console only.
  4179.  
  4180. Return Value
  4181. ------------
  4182.  
  4183. Zero on success, nonzero on failure.
  4184.  
  4185. Portability
  4186. -----------
  4187.  
  4188. not ANSI, not POSIX
  4189.  
  4190. 
  4191. File: libc.info,  Node: cfree,  Next: cfsetispeed,  Prev: cfmakeraw,  Up: Alphabetical List
  4192.  
  4193. cfree
  4194. =====
  4195.  
  4196. Syntax
  4197. ------
  4198.  
  4199.      #include <stdlib.h>
  4200.      
  4201.      void cfree(void *pointer);
  4202.  
  4203. Description
  4204. -----------
  4205.  
  4206. This function returns the memory allocated by calloc (*note calloc::.)
  4207. to the heap.
  4208.  
  4209. Return Value
  4210. ------------
  4211.  
  4212. None.
  4213.  
  4214. Portability
  4215. -----------
  4216.  
  4217. not ANSI, not POSIX
  4218.  
  4219. Example
  4220. -------
  4221.  
  4222.      Complex *x = calloc(12, sizeof(Complex));
  4223.      cfree(x);
  4224.  
  4225. 
  4226. File: libc.info,  Node: cfsetispeed,  Next: cfsetospeed,  Prev: cfree,  Up: Alphabetical List
  4227.  
  4228. cfsetispeed
  4229. ===========
  4230.  
  4231. Syntax
  4232. ------
  4233.  
  4234.      #include <termios.h>
  4235.      
  4236.      int cfsetispeed (struct termios *termiosp, speed_t speed);
  4237.  
  4238. Description
  4239. -----------
  4240.  
  4241. This function sets the input line speed stored in the structure
  4242. TERMIOSP to SPEED.  *Note Termios functions::, for more details about
  4243. this structure and the baudrate values it supports.
  4244.  
  4245. Note that the termios emulation handles console only, and that the
  4246. baudrate values have no effect in this implementation.
  4247.  
  4248. Return Value
  4249. ------------
  4250.  
  4251. Zero on success, nonzero on failure.
  4252.  
  4253. Portability
  4254. -----------
  4255.  
  4256. not ANSI, POSIX
  4257.  
  4258. 
  4259. File: libc.info,  Node: cfsetospeed,  Next: cfsetspeed,  Prev: cfsetispeed,  Up: Alphabetical List
  4260.  
  4261. cfsetospeed
  4262. ===========
  4263.  
  4264. Syntax
  4265. ------
  4266.  
  4267.      #include <termios.h>
  4268.      
  4269.      int cfsetospeed (struct termios *termiosp, speed_t speed);
  4270.  
  4271. Description
  4272. -----------
  4273.  
  4274. This function sets the output line speed stored in the structure
  4275. TERMIOSP to SPEED.  *Note Termios functions::, for more details about
  4276. this structure and the baudrate values it supports.
  4277.  
  4278. Note that the termios emulation handles console only, and that the
  4279. baudrate values have no effect in this implementation.
  4280.  
  4281. Return Value
  4282. ------------
  4283.  
  4284. Zero on success, nonzero on failure.
  4285.  
  4286. Portability
  4287. -----------
  4288.  
  4289. not ANSI, POSIX
  4290.  
  4291. 
  4292. File: libc.info,  Node: cfsetspeed,  Next: cgets,  Prev: cfsetospeed,  Up: Alphabetical List
  4293.  
  4294. cfsetspeed
  4295. ==========
  4296.  
  4297. Syntax
  4298. ------
  4299.  
  4300.      #include <termios.h>
  4301.      
  4302.      int cfsetspeed (struct termios *termiosp, speed_t speed);
  4303.  
  4304. Description
  4305. -----------
  4306.  
  4307. This function sets the input and output line speed stored in the
  4308. structure TERMIOSP to SPEED.  It is provided for compatibility only.
  4309. Note that the termios emulation handles console only.
  4310.  
  4311. Return Value
  4312. ------------
  4313.  
  4314. Zero on success, nonzero on failure.
  4315.  
  4316. Portability
  4317. -----------
  4318.  
  4319. not ANSI, not POSIX
  4320.  
  4321. 
  4322. File: libc.info,  Node: cgets,  Next: chdir,  Prev: cfsetspeed,  Up: Alphabetical List
  4323.  
  4324. cgets
  4325. =====
  4326.  
  4327. Syntax
  4328. ------
  4329.  
  4330.      #include <conio.h>
  4331.      
  4332.      char *cgets(char *_str);
  4333.  
  4334. Description
  4335. -----------
  4336.  
  4337. Get a string from the console.  This will take advantage of any
  4338. command-line editing TSRs.  To use, you must pre-fill the first
  4339. character of the buffer.  The first character is the size of the
  4340. buffer.  On return, the second character is the number of characters
  4341. read.  The third character is the first character read.
  4342.  
  4343. Return Value
  4344. ------------
  4345.  
  4346. A pointer to the first character read.
  4347.  
  4348. Portability
  4349. -----------
  4350.  
  4351. not ANSI, not POSIX
  4352.  
  4353. 
  4354. File: libc.info,  Node: chdir,  Next: _check_v2_prog,  Prev: cgets,  Up: Alphabetical List
  4355.  
  4356. chdir
  4357. =====
  4358.  
  4359. Syntax
  4360. ------
  4361.  
  4362.      #include <unistd.h>
  4363.      
  4364.      int chdir(const char *new_directory);
  4365.  
  4366. Description
  4367. -----------
  4368.  
  4369. This function changes the current directory to NEW_DIRECTORY.  If a
  4370. drive letter is specified, the current directory for that drive is
  4371. changed and the current disk is set to that drive, else the current
  4372. directory for the current drive is changed.
  4373.  
  4374. Return Value
  4375. ------------
  4376.  
  4377. Zero if the new directory exists, else nonzero and ERRNO set if error.
  4378.  
  4379. Portability
  4380. -----------
  4381.  
  4382. not ANSI, POSIX
  4383.  
  4384. Example
  4385. -------
  4386.  
  4387.      if (chdir("/tmp"))
  4388.        perror("/tmp");
  4389.  
  4390. 
  4391. File: libc.info,  Node: _check_v2_prog,  Next: chmod,  Prev: chdir,  Up: Alphabetical List
  4392.  
  4393. _check_v2_prog
  4394. ==============
  4395.  
  4396. Syntax
  4397. ------
  4398.  
  4399.      #include <sys/system.h>
  4400.      
  4401.      const _v2_prog_type *_check_v2_prog(const char *program, int fd);
  4402.  
  4403. Description
  4404. -----------
  4405.  
  4406. This function checks a given program for various known types of
  4407. executables and/or other things. This function povides two differnt
  4408. entry points. One is to call the function with a not `NULL' pointer as
  4409. `program' (in this case `fd' is ignored), then the file named by
  4410. `program' is opened and closed by `_check_v2_prog'.
  4411.  
  4412. When you pass `NULL' as `program', then you have to pass a valid file
  4413. handle in `fd' and `_check_v2_prog' uses that handle and does also not
  4414. close the file on return.
  4415.  
  4416. Return Value
  4417. ------------
  4418.  
  4419. `_v2_prog_type' is defined in `sys/system.h' like the following:
  4420.  
  4421.  
  4422.      typedef struct {
  4423.        char magic[16];
  4424.        int struct_length;
  4425.        char go32[16];
  4426.        unsigned char buffer[0];
  4427.      } _v1_stubinfo;
  4428.      
  4429.      
  4430.      typedef struct {
  4431.        union {
  4432.          unsigned version:8; /* The version of DJGPP created that COFF exe */
  4433.          struct {
  4434.            unsigned minor:4; /* The minor version of DJGPP */
  4435.            unsigned major:4; /* The major version of DJGPP */
  4436.          } v;
  4437.        } version;
  4438.      
  4439.        unsigned object_format:4; /* What an object format */
  4440.      # define _V2_OBJECT_FORMAT_UNKNOWN 0x00
  4441.      # define _V2_OBJECT_FORMAT_COFF    0x01
  4442.      
  4443.        unsigned exec_format:4; /* What an executable format */
  4444.      # define _V2_EXEC_FORMAT_UNKNOWN    0x00
  4445.      # define _V2_EXEC_FORMAT_COFF       0x01
  4446.      # define _V2_EXEC_FORMAT_STUBCOFF   0x02
  4447.      # define _V2_EXEC_FORMAT_EXE        0x03
  4448.      # define _V2_EXEC_FORMAT_UNIXSCRIPT 0x04
  4449.      
  4450.        unsigned valid:1; /* Only when nonzero all the information is valid */
  4451.      
  4452.        unsigned has_stubinfo:1; /* When nonzero the stubinfo info is valid */
  4453.      
  4454.        unsigned unused:14;
  4455.      
  4456.        _v1_stubinfo *stubinfo;
  4457.      } _v2_prog_type;
  4458.  
  4459. The macros shown above can be used to test the different members of that
  4460. structure for known values.
  4461.  
  4462. *Warning:* Do not modify any of the data in this structure.
  4463.  
  4464. After calling `_check_v2_prog' you should check at first the member
  4465. `valid'. Only if this is nonzero you can be sure that all the other
  4466. information in the struct is valid.
  4467.  
  4468. The same is for the `stubinfo' member of the above struct, it is valid
  4469. only, when `has_stubinfo' is nonzero.
  4470.  
  4471. Portability
  4472. -----------
  4473.  
  4474. not ANSI, not POSIX
  4475.  
  4476. Example
  4477. -------
  4478.  
  4479. To use the information returned in the struct you can use code like the
  4480. following:
  4481.  
  4482.  
  4483.      #include <stdio.h>
  4484.      #include <sys/system.h>
  4485.      
  4486.      int main()
  4487.      {
  4488.        const _v2_prog_type *type;
  4489.        /* Since we pass a valid name, we can use -1 as the second argument */
  4490.        type = _check_v2_prog ("foo", -1);
  4491.      
  4492.        /* There was something wrong */
  4493.        if (!type->valid)
  4494.        {
  4495.          fprintf(stderr, "Could not check the file 'foo'. Giving up.\\n");
  4496.          return 1;
  4497.        }
  4498.      
  4499.        /* Currently only the COFF format is valid to be a V2 executable */
  4500.        if (type->object_format != _V2_OBJECT_FORMAT_COFF)
  4501.        {
  4502.          fprintf(stderr, "File 'foo' is not in COFF format\\n");
  4503.          return 2;
  4504.        }
  4505.      
  4506.        /* The major version is not 2 */
  4507.        if (type->version.v.major != 2)
  4508.        {
  4509.          fprintf(stderr, "File 'foo' is not from DJGPP 2.xx\\n");
  4510.          return 3;
  4511.        }
  4512.      
  4513.        fprintf(stdout, "File 'foo' is a valid DJGPP 2.xx executable\\n");
  4514.      
  4515.        if (type->exec_format == _V2_EXEC_FORMAT_STUBCOFF)
  4516.        {
  4517.          fprintf(stdout, "File 'foo' has a stub loader prepended\\n");
  4518.        }
  4519.      
  4520.        return 0;
  4521.      }
  4522.  
  4523. 
  4524. File: libc.info,  Node: chmod,  Next: _chmod,  Prev: _check_v2_prog,  Up: Alphabetical List
  4525.  
  4526. chmod
  4527. =====
  4528.  
  4529. Syntax
  4530. ------
  4531.  
  4532.      #include <sys/stat.h>
  4533.      
  4534.      int chmod(const char *path, mode_t mode);
  4535.  
  4536. Description
  4537. -----------
  4538.  
  4539. This function changes the mode (writable or write-only) of the specified
  4540. file.  The value of MODE can be a combination of one or more of the
  4541. following:
  4542.  
  4543. `S_IRUSR'
  4544.      Make the file readable
  4545.  
  4546. `S_IWUSR'
  4547.      Make the file writable
  4548.  
  4549. Other `S_I*' values could be included, but they will be ignored.
  4550.  
  4551. Return Value
  4552. ------------
  4553.  
  4554. Zero if the file exists and the mode was changed, else nonzero.
  4555.  
  4556. Portability
  4557. -----------
  4558.  
  4559. not ANSI, POSIX
  4560.  
  4561. Example
  4562. -------
  4563.  
  4564.      chmod("/tmp/dj.dat", S_IWUSR|S_IRUSR);
  4565.  
  4566. 
  4567. File: libc.info,  Node: _chmod,  Next: chown,  Prev: chmod,  Up: Alphabetical List
  4568.  
  4569. _chmod
  4570. ======
  4571.  
  4572. Syntax
  4573. ------
  4574.  
  4575.      #include <io.h>
  4576.      
  4577.      int _chmod(const char *filename, int func, mode_t mode);
  4578.  
  4579. Description
  4580. -----------
  4581.  
  4582. This is a direct connection to the MS-DOS chmod function call, int
  4583. 0x21, %ax = 0x4300/0x4301.  If FUNC is 0, then DOS is called with AX =
  4584. 0x4300, which returns an attribute byte of a file.  If FUNC is 1, then
  4585. the attributes of a file are set as specified in MODE.  Note that the
  4586. directory and volume attribute bits must always be 0 when `_chmod()' is
  4587. called with FUNC = 1, or else the call will fail.  The third argument
  4588. is optional when getting attributes.  The attribute bits are defined as
  4589. follows:
  4590.  
  4591.        Bit       Meaning
  4592.      76543210
  4593.      .......1    Read-only
  4594.      ......1.    Hidden
  4595.      .....1..    System
  4596.      ....1...    Volume Label
  4597.      ...1....    Directory
  4598.      ..1.....    Archive
  4599.      xx......    Reserved (used by some network redirectors)
  4600.  
  4601. On platforms where the LFN API (*note LFN: _use_lfn.) is available,
  4602. `_chmod' calls function 0x7143 of Interrupt 21h, to support long file
  4603. names.
  4604.  
  4605. Return Value
  4606. ------------
  4607.  
  4608. If the file exists, `_chmod()' returns its attribute byte in case it
  4609. succeded, or -1 in case of failure.
  4610.  
  4611. Portability
  4612. -----------
  4613.  
  4614. not ANSI, not POSIX
  4615.  
  4616. 
  4617. File: libc.info,  Node: chown,  Next: chsize,  Prev: _chmod,  Up: Alphabetical List
  4618.  
  4619. chown
  4620. =====
  4621.  
  4622. Syntax
  4623. ------
  4624.  
  4625.      #include <unistd.h>
  4626.      
  4627.      int chown(const char *file, int owner, int group);
  4628.  
  4629. Description
  4630. -----------
  4631.  
  4632. This function does nothing under MS-DOS
  4633.  
  4634. Return Value
  4635. ------------
  4636.  
  4637. This function always returns zero if the file exists, else it returns
  4638. -1 and sets ERRNO to `ENOENT'.
  4639.  
  4640. Portability
  4641. -----------
  4642.  
  4643. not ANSI, POSIX
  4644.  
  4645. 
  4646. File: libc.info,  Node: chsize,  Next: cleanup_client,  Prev: chown,  Up: Alphabetical List
  4647.  
  4648. chsize
  4649. ======
  4650.  
  4651. Syntax
  4652. ------
  4653.  
  4654.      #include <io.h>
  4655.      
  4656.      int chsize(int handle, long size);
  4657.  
  4658. Description
  4659. -----------
  4660.  
  4661. Just calls ftruncate (*note ftruncate::.).
  4662.  
  4663. Return Value
  4664. ------------
  4665.  
  4666. Zero on success, -1 on failure.
  4667.  
  4668. Portability
  4669. -----------
  4670.  
  4671. not ANSI, not POSIX
  4672.  
  4673. 
  4674. File: libc.info,  Node: cleanup_client,  Next: _clear87,  Prev: chsize,  Up: Alphabetical List
  4675.  
  4676. cleanup_client
  4677. ==============
  4678.  
  4679. Syntax
  4680. ------
  4681.  
  4682.      #include <debug/dbgcom.h>
  4683.      
  4684.      void cleanup_client (void);
  4685.  
  4686. Description
  4687. -----------
  4688.  
  4689. This functions is typically called when the debugged process exits or is
  4690. aborted.  It restores segment descriptors, closes file handles that were
  4691. left open by the debuggee, frees protected-mode and conventional memory
  4692. and any segment descriptors allocated by the debuggee, and restores the
  4693. debugger's original signal handlers.
  4694.  
  4695. 
  4696. File: libc.info,  Node: _clear87,  Next: clearerr,  Prev: cleanup_client,  Up: Alphabetical List
  4697.  
  4698. _clear87
  4699. ========
  4700.  
  4701. Syntax
  4702. ------
  4703.  
  4704.      #include <float.h>
  4705.      
  4706.      unsigned int _clear87(void);
  4707.  
  4708. Description
  4709. -----------
  4710.  
  4711. Clears the floating point processor's exception flags.
  4712.  
  4713. Return Value
  4714. ------------
  4715.  
  4716. The previous status word.
  4717.  
  4718. Portability
  4719. -----------
  4720.  
  4721. not ANSI, not POSIX
  4722.  
  4723. 
  4724. File: libc.info,  Node: clearerr,  Next: clock,  Prev: _clear87,  Up: Alphabetical List
  4725.  
  4726. clearerr
  4727. ========
  4728.  
  4729. Syntax
  4730. ------
  4731.  
  4732.      #include <stdio.h>
  4733.      
  4734.      void clearerr(FILE *stream);
  4735.  
  4736. Description
  4737. -----------
  4738.  
  4739. This function clears the EOF and error indicators for the file STREAM.
  4740.  
  4741. Return Value
  4742. ------------
  4743.  
  4744. None.
  4745.  
  4746. Portability
  4747. -----------
  4748.  
  4749. ANSI, POSIX
  4750.  
  4751. Example
  4752. -------
  4753.  
  4754.      clearerr(stdout);
  4755.  
  4756. 
  4757. File: libc.info,  Node: clock,  Next: close,  Prev: clearerr,  Up: Alphabetical List
  4758.  
  4759. clock
  4760. =====
  4761.  
  4762. Syntax
  4763. ------
  4764.  
  4765.      #include <time.h>
  4766.      
  4767.      clock_t clock(void);
  4768.  
  4769. Description
  4770. -----------
  4771.  
  4772. This function returns the number of clock ticks since an arbitrary time,
  4773. actually, since the first call to `clock', which itself returns zero.
  4774. The number of tics per second is CLOCKS_PER_SEC.
  4775.  
  4776. Return Value
  4777. ------------
  4778.  
  4779. The number of tics.
  4780.  
  4781. Portability
  4782. -----------
  4783.  
  4784. ANSI, POSIX
  4785.  
  4786. Example
  4787. -------
  4788.  
  4789.      printf("%d seconds have elapsed\n", clock()/CLOCKS_PER_SEC);
  4790.  
  4791. 
  4792. File: libc.info,  Node: close,  Next: _close,  Prev: clock,  Up: Alphabetical List
  4793.  
  4794. close
  4795. =====
  4796.  
  4797. Syntax
  4798. ------
  4799.  
  4800.      #include <unistd.h>
  4801.      
  4802.      int close(int fd);
  4803.  
  4804. Description
  4805. -----------
  4806.  
  4807. The open file associated with FD is closed.
  4808.  
  4809. Return Value
  4810. ------------
  4811.  
  4812. Zero if the file was closed, nonzero if FD was invalid or already
  4813. closed.
  4814.  
  4815. Portability
  4816. -----------
  4817.  
  4818. not ANSI, POSIX
  4819.  
  4820. Example
  4821. -------
  4822.  
  4823.      int fd = open("data", O_RDONLY);
  4824.      close(fd);
  4825.  
  4826. 
  4827. File: libc.info,  Node: _close,  Next: closedir,  Prev: close,  Up: Alphabetical List
  4828.  
  4829. _close
  4830. ======
  4831.  
  4832. Syntax
  4833. ------
  4834.  
  4835.      #include <io.h>
  4836.      
  4837.      int _close(int fd);
  4838.  
  4839. Description
  4840. -----------
  4841.  
  4842. This is a direct connection to the MS-DOS close function call, int
  4843. 0x21, %ah = 0x3e. This function can be hooked by the *Note File System
  4844. Extensions::. If you don't want this, you should use *Note _dos_close::.
  4845.  
  4846. Return Value
  4847. ------------
  4848.  
  4849. Zero if the file was closed, else nonzero.
  4850.  
  4851. Portability
  4852. -----------
  4853.  
  4854. not ANSI, not POSIX
  4855.  
  4856. 
  4857. File: libc.info,  Node: closedir,  Next: clreol,  Prev: _close,  Up: Alphabetical List
  4858.  
  4859. closedir
  4860. ========
  4861.  
  4862. Syntax
  4863. ------
  4864.  
  4865.      #include <dirent.h>
  4866.      
  4867.      int closedir(DIR *dir);
  4868.  
  4869. Description
  4870. -----------
  4871.  
  4872. This function closes a directory opened by opendir (*note opendir::.).
  4873.  
  4874. Return Value
  4875. ------------
  4876.  
  4877. Zero on success, nonzero if DIR is invalid.
  4878.  
  4879. Portability
  4880. -----------
  4881.  
  4882. not ANSI, POSIX
  4883.  
  4884. 
  4885. File: libc.info,  Node: clreol,  Next: clrscr,  Prev: closedir,  Up: Alphabetical List
  4886.  
  4887. clreol
  4888. ======
  4889.  
  4890. Syntax
  4891. ------
  4892.  
  4893.      #include <conio.h>
  4894.      
  4895.      void clreol(void);
  4896.  
  4897. Description
  4898. -----------
  4899.  
  4900. Clear to end of line.
  4901.  
  4902. Return Value
  4903. ------------
  4904.  
  4905. None.
  4906.  
  4907. Portability
  4908. -----------
  4909.  
  4910. not ANSI, not POSIX
  4911.  
  4912. 
  4913. File: libc.info,  Node: clrscr,  Next: _conio_kbhit,  Prev: clreol,  Up: Alphabetical List
  4914.  
  4915. clrscr
  4916. ======
  4917.  
  4918. Syntax
  4919. ------
  4920.  
  4921.      #include <conio.h>
  4922.      
  4923.      void clrscr(void);
  4924.  
  4925. Description
  4926. -----------
  4927.  
  4928. Clear the entire screen.
  4929.  
  4930. Portability
  4931. -----------
  4932.  
  4933. not ANSI, not POSIX
  4934.  
  4935. 
  4936. File: libc.info,  Node: _conio_kbhit,  Next: _control87,  Prev: clrscr,  Up: Alphabetical List
  4937.  
  4938. _conio_kbhit
  4939. ============
  4940.  
  4941. Syntax
  4942. ------
  4943.  
  4944.      #include <conio.h>
  4945.      
  4946.      int _conio_kbhit(void);
  4947.  
  4948. Description
  4949. -----------
  4950.  
  4951. Determines whether or not a character is waiting at the keyboard.  If
  4952. there is an ungetch'd character, this function returns true.  Note that
  4953. if you include `conio.h', the *Note kbhit:: function is redefined to be
  4954. this function instead.
  4955.  
  4956. Return Value
  4957. ------------
  4958.  
  4959. Nonzero if a key is waiting, else zero.
  4960.  
  4961. Portability
  4962. -----------
  4963.  
  4964. not ANSI, not POSIX
  4965.  
  4966. 
  4967. File: libc.info,  Node: _control87,  Next: cos,  Prev: _conio_kbhit,  Up: Alphabetical List
  4968.  
  4969. _control87
  4970. ==========
  4971.  
  4972. Syntax
  4973. ------
  4974.  
  4975.      #include <float.h>
  4976.      
  4977.      unsigned int _control87(unsigned int newcw, unsigned int mask);
  4978.  
  4979. Description
  4980. -----------
  4981.  
  4982. This function sets and retrieves the FPU's "control word".
  4983.  
  4984. The control word is a special 16-bit register maintained by the math
  4985. coprocessor.  By setting and clearing bit fields in the control word,
  4986. you can exercise control of certain aspects of coprocessor operation.
  4987. The individual bits of the x87 control word are defined by macros in
  4988. float.h, and shown in this table:
  4989.  
  4990.      ---- ---- --XX XXXX = MCW_EM - exception masks (1=handle exception internally, 0=fault)
  4991.      ---- ---- ---- ---X = EM_INVALID - invalid operation
  4992.      ---- ---- ---- --X- = EM_DENORMAL - denormal operand
  4993.      ---- ---- ---- -X-- = EM_ZERODIVIDE - divide by zero
  4994.      ---- ---- ---- X--- = EM_OVERFLOW - overflow
  4995.      ---- ---- ---X ---- = EM_UNDERFLOW - underflow
  4996.      ---- ---- --X- ---- = EM_INEXACT - rounding was required
  4997.      ---- --XX ---- ---- = MCW_PC - precision control
  4998.      ---- --00 ---- ---- = PC_24 - single precision
  4999.      ---- --10 ---- ---- = PC_53 - double precision
  5000.      ---- --11 ---- ---- = PC_64 - extended precision
  5001.      ---- XX-- ---- ---- = MCW_RC - rounding control
  5002.      ---- 00-- ---- ---- = RC_NEAR - round to nearest
  5003.      ---- 01-- ---- ---- = RC_DOWN - round towards -Inf
  5004.      ---- 10-- ---- ---- = RC_UP - round towards +Inf
  5005.      ---- 11-- ---- ---- = RC_CHOP - round towards zero
  5006.      ---X ---- ---- ---- = MCW_IC - infinity control (obsolete, always affine)
  5007.      ---0 ---- ---- ---- = IC_AFFINE - -Inf < +Inf
  5008.      ---1 ---- ---- ---- = IC_PROJECTIVE - -Inf == +Inf
  5009.  
  5010. `_control87' uses the value of NEWCW and MASK variables together to
  5011. determine which bits of the FPU's control word should be set, and to
  5012. what values.  For each bit in MASK that is set (equals to 1), the
  5013. corresponding bit in NEWCW specifies the new value of the same bit in
  5014. the FPU's control word, which `_control87' should set.  Bits which
  5015. correspond to reset (zero) bits in MASK are not changed in the FPU's
  5016. control word.  Thus, using a zero value for MASK retrieves the current
  5017. value of the control word without changing it.
  5018.  
  5019. The exception bits `MCW_EM' (the low-order 6 bits) of the control word
  5020. define the exception *mask*.  That is, if a certain bit is set, the
  5021. corresponding exception will be masked, i.e., it will not generate an
  5022. FP exception (which normally causes signal `SIGFPE' to be delivered).
  5023. A masked exception will be handled internally by the coprocessor.  In
  5024. general, that means that it will generate special results, such as
  5025. "NaN", Not-a-Number (e.g., when you attempt to compute a square root of
  5026. a negative number), denormalized result (in case of underflow), or
  5027. infinity (e.g., in the case of division by zero, or when the result
  5028. overflows).
  5029.  
  5030. By default, DJGPP startup code masks all FP exceptions.
  5031.  
  5032. The precision-control field `MCW_PC' (bits 8 and 9) controls the
  5033. internal precision of the coprocessor by selecting the number of
  5034. precision bits in the mantissa of the FP numbers.  The values `PC_24',
  5035. `PC_53', and `PC_64' set the precision to 24, 53, and 64-bit mantissa,
  5036. respectively.  This feature of the coprocessor is for compatibility
  5037. with the "IEEE 745 standard" and only affect the `FADD', `FSUB'
  5038. `FSUBR', `FMUL', `FDIV', `FDIVR', and `FSQRT' instructions.  Lowering
  5039. the precision will *not* decrease the execution time of FP instructions.
  5040.  
  5041. The `MCW_PC' field is set to use the full-precision 64-bit mantissa by
  5042. the DJGPP startup code.
  5043.  
  5044. The rounding-control field `MCW_RC' (bits 10 and 11) controls the type
  5045. (round or chop) and direction (-Inf or +Inf) of the rounding.  It only
  5046. affects arithmetic instructions.  Set to round-to-nearest state by the
  5047. DJGPP startup code.
  5048.  
  5049. The infinity-control bit `MCW_IC' has no effect on 80387 and later
  5050. coprocessors.
  5051.  
  5052. Return Value
  5053. ------------
  5054.  
  5055. The previous control word.
  5056.  
  5057. (Note that this is different from what `_control87' from the Borland C
  5058. library which returns the *new* control word.)
  5059.  
  5060. Portability
  5061. -----------
  5062.  
  5063. not ANSI, not POSIX
  5064.  
  5065. Example
  5066. -------
  5067.  
  5068.        /* mask all exceptions, except invalid operation */
  5069.        _control87 (0x033e, 0xffff);
  5070.  
  5071. 
  5072. File: libc.info,  Node: cos,  Next: cosh,  Prev: _control87,  Up: Alphabetical List
  5073.  
  5074. cos
  5075. ===
  5076.  
  5077. Syntax
  5078. ------
  5079.  
  5080.      #include <math.h>
  5081.      
  5082.      double cos(double x);
  5083.  
  5084. Description
  5085. -----------
  5086.  
  5087. This function computes the cosine of X (which should be given in
  5088. radians).
  5089.  
  5090. Return Value
  5091. ------------
  5092.  
  5093. The cosine of X.  If the absolute value of X is finite but greater than
  5094. or equal to 2^63, the value is 1 (since for arguments that large each
  5095. bit of the mantissa is more than `Pi').  If the value of X is infinite
  5096. or `NaN', the return value is `NaN' and `errno' is set to `EDOM'.
  5097.  
  5098. Portability
  5099. -----------
  5100.  
  5101. ANSI, POSIX
  5102.  
  5103. Accuracy
  5104. --------
  5105.  
  5106. In general, this function's relative accuracy is about 1.7*10^(-16),
  5107. which is close to the machine precision for a `double'.  However, for
  5108. arguments very close to `Pi/2' and its odd multiples, the relative
  5109. accuracy can be many times worse, due to loss of precision in the
  5110. internal FPU computations.  Since cos(Pi/2) is zero, the absolute
  5111. accuracy is still very good; but if your program needs to preserve high
  5112. *relative* accuracy for such arguments, link with `-lm' and use the
  5113. version of `cos' from `libm.a' which does elaborate argument reduction,
  5114. but is about three times slower.
  5115.  
  5116. 
  5117. File: libc.info,  Node: cosh,  Next: cprintf,  Prev: cos,  Up: Alphabetical List
  5118.  
  5119. cosh
  5120. ====
  5121.  
  5122. Syntax
  5123. ------
  5124.  
  5125.      #include <math.h>
  5126.      
  5127.      double cosh(double x);
  5128.  
  5129. Description
  5130. -----------
  5131.  
  5132. This function computes the hyperbolic sine of X.
  5133.  
  5134. Return Value
  5135. ------------
  5136.  
  5137. The hyperbolic cosine of X.  If the value of X is a `NaN', the return
  5138. value is `NaN' and `errno' is set to `EDOM'.  If the value of X is so
  5139. large that the result would overflow a `double', the return value is
  5140. `Inf' and `errno' is set to `ERANGE'.  If X is either a positive or a
  5141. negative infinity, the result is `+Inf', and `errno' is not changed.
  5142.  
  5143. Portability
  5144. -----------
  5145.  
  5146. ANSI, POSIX
  5147.  
  5148. 
  5149. File: libc.info,  Node: cprintf,  Next: cputs,  Prev: cosh,  Up: Alphabetical List
  5150.  
  5151. cprintf
  5152. =======
  5153.  
  5154. Syntax
  5155. ------
  5156.  
  5157.      #include <conio.h>
  5158.      
  5159.      int cprintf(const char *_format, ...);
  5160.  
  5161. Description
  5162. -----------
  5163.  
  5164. Like `printf' (*note printf::.), but prints through the console, taking
  5165. into consideration window borders and text attributes.  There is
  5166. currently a 2048-byte limit on the size of each individual cprintf call.
  5167.  
  5168. Return Value
  5169. ------------
  5170.  
  5171. The number of characters written.
  5172.  
  5173. Portability
  5174. -----------
  5175.  
  5176. not ANSI, not POSIX
  5177.  
  5178. 
  5179. File: libc.info,  Node: cputs,  Next: creat,  Prev: cprintf,  Up: Alphabetical List
  5180.  
  5181. cputs
  5182. =====
  5183.  
  5184. Syntax
  5185. ------
  5186.  
  5187.      #include <conio.h>
  5188.      
  5189.      int cputs(const char *_str);
  5190.  
  5191. Description
  5192. -----------
  5193.  
  5194. Puts the string onto the console.  The cursor position is updated.
  5195.  
  5196. Return Value
  5197. ------------
  5198.  
  5199. Zero on success.
  5200.  
  5201. Portability
  5202. -----------
  5203.  
  5204. not ANSI, not POSIX
  5205.  
  5206. 
  5207. File: libc.info,  Node: creat,  Next: _creat,  Prev: cputs,  Up: Alphabetical List
  5208.  
  5209. creat
  5210. =====
  5211.  
  5212. Syntax
  5213. ------
  5214.  
  5215.      #include <fcntl.h>
  5216.      #include <sys/stat.h> /* for mode definitions */
  5217.      
  5218.      int creat(const char *filename, mode_t mode);
  5219.  
  5220. Description
  5221. -----------
  5222.  
  5223. This function creates the given file and opens it for writing.  If the
  5224. file exists, it is truncated to zero size, unless it is read-only, in
  5225. which case the function fails.  If the file does not exist, it will be
  5226. created read-only if MODE does not have `S_IWUSR' set.
  5227.  
  5228. Return Value
  5229. ------------
  5230.  
  5231. A file descriptor >= 0, or a negative number on error.
  5232.  
  5233. Portability
  5234. -----------
  5235.  
  5236. not ANSI, POSIX
  5237.  
  5238. Example
  5239. -------
  5240.  
  5241.      int fd = creat("data", S_IRUSR|S_IWUSR);
  5242.      write(fd, buf, 1024);
  5243.      close(fd);
  5244.  
  5245. 
  5246. File: libc.info,  Node: _creat,  Next: _creatnew,  Prev: creat,  Up: Alphabetical List
  5247.  
  5248. _creat
  5249. ======
  5250.  
  5251. Syntax
  5252. ------
  5253.  
  5254.      #include <io.h>
  5255.      
  5256.      int _creat(const char *path, int attrib);
  5257.  
  5258. Description
  5259. -----------
  5260.  
  5261. This is a direct connection to the MS-DOS creat function call, int 0x21,
  5262. %ah = 0x3c.  The file is set to binary mode.  This function can be
  5263. hooked by the "File System Extensions", see *Note File System
  5264. Extensions::.  If you don't want this, you should use `_dos_creat'
  5265. (*note _dos_creat::.) or `_dos_creatnew' (*note _dos_creatnew::.).
  5266.  
  5267. On platforms where the LFN API (*note LFN: _use_lfn.) is available,
  5268. `_creat' calls function 0x716C of Interrupt 21h, to support long file
  5269. names.
  5270.  
  5271. Return Value
  5272. ------------
  5273.  
  5274. The new file descriptor, else -1 on error.
  5275.  
  5276. Portability
  5277. -----------
  5278.  
  5279. not ANSI, not POSIX
  5280.  
  5281. 
  5282. File: libc.info,  Node: _creatnew,  Next: crlf2nl,  Prev: _creat,  Up: Alphabetical List
  5283.  
  5284. _creatnew
  5285. =========
  5286.  
  5287. Syntax
  5288. ------
  5289.  
  5290.      #include <fcntl.h>
  5291.      #include <dir.h>
  5292.      #include <io.h>
  5293.      
  5294.      int _creatnew(const char *path, int attrib, int flags);
  5295.  
  5296. Description
  5297. -----------
  5298.  
  5299. This function creates a file given by PATH and opens it, like `_creat'
  5300. does, but only if it didn't already exist.  If the named file exists,
  5301. `_creatnew' fails.  (In contrast, `_creat' opens existing files and
  5302. overwrites their contents, see *Note _creat::.)
  5303.  
  5304. The attributes of the created file are determined by ATTRIB.  The file
  5305. is usually given the normal attribute (00H).  If ATTRIB is non-zero,
  5306. additional attributes will be set.  The following macros, defined on
  5307. `<dir.h>', can be used to control the attributes of the created file
  5308. (the associated numeric values appear in parentheses):
  5309.  
  5310. `FA_RDONLY (1)'
  5311.      The file is created with the read-only bit set.
  5312.  
  5313. `FA_HIDDEN (2)'
  5314.      The file is created with the hidden bit set.  Such files will not
  5315.      appear in directory listings unless you use special options to the
  5316.      commands which list files.
  5317.  
  5318. `FA_SYSTEM (4)'
  5319.      The file is created with the system bit set.  Such files will not
  5320.      appear in directory listings unless you use special options to the
  5321.      commands which list files.
  5322.  
  5323. Other bits (`FA_LABEL' and `FA_DIREC') are ignored by DOS.
  5324.  
  5325. The argument FLAGS controls the sharing mode and the fine details of
  5326. how the file is handled by the operating system.  The following macros,
  5327. defined on `<fcntl.h>', can be used for this (associated numeric values
  5328. are given in parentheses):
  5329.  
  5330. `SH_COMPAT (00h)'
  5331.      Opens the file in compatibility mode, which allows any other
  5332.      process to open the file and read from the file any number of
  5333.      times.
  5334.  
  5335. `SH_DENYRW (10h)'
  5336.      Denies both read and write access by other processes.
  5337.  
  5338. `SH_DENYWR (20h)'
  5339.      Denies write access by other processes.
  5340.  
  5341. `SH_DENYRD (30h)'
  5342.      Denies read access by other processes.
  5343.  
  5344. `SH_DENYNO (40h)'
  5345.      Allows read and write access by other processes, but prevents other
  5346.      processes from opening the file in compatibility mode.
  5347.  
  5348. Note that the file is always open for both reading and writing;
  5349. `_creatnew' ignores any bits in the lower nibble of FLAGS (`O_RDONLY',
  5350. `O_WRONLY', etc.).
  5351.  
  5352. `_creatnew' calls DOS function 716Ch when long file names are
  5353. supported, 6C00h otherwise.  (On DOS version 3.x, function 5B00h is
  5354. called which ignores the value of FLAGS, since function 6C00h is only
  5355. supported by DOS 4.0 and later.)
  5356.  
  5357. The file handle returned by `_creatnew' is set to binary mode.
  5358.  
  5359. This function can be hooked by the Filesystem Extensions handlers, as
  5360. described in *Note File System Extensions::.  If you don't want this,
  5361. you should use `_dos_creatnew' (*note _dos_creatnew::.) instead.
  5362.  
  5363. Return Value
  5364. ------------
  5365.  
  5366. The new file descriptor, else -1 on error.
  5367.  
  5368. Portability
  5369. -----------
  5370.  
  5371. not ANSI, not POSIX
  5372.  
  5373. 
  5374. File: libc.info,  Node: crlf2nl,  Next: __crt0_glob_function,  Prev: _creatnew,  Up: Alphabetical List
  5375.  
  5376. crlf2nl
  5377. =======
  5378.  
  5379. Syntax
  5380. ------
  5381.  
  5382.      #include <io.h>
  5383.      
  5384.      size_t crlf2nl(char *buf, ssize_t len);
  5385.  
  5386. Description
  5387. -----------
  5388.  
  5389. This function removes Ctrl-M characters from the given BUF.
  5390.  
  5391. Return Value
  5392. ------------
  5393.  
  5394. The number of characters remaining in the buffer are returned.
  5395.  
  5396. Portability
  5397. -----------
  5398.  
  5399. not ANSI, not POSIX
  5400.  
  5401. 
  5402. File: libc.info,  Node: __crt0_glob_function,  Next: __crt0_load_environment_file,  Prev: crlf2nl,  Up: Alphabetical List
  5403.  
  5404. __crt0_glob_function
  5405. ====================
  5406.  
  5407. Syntax
  5408. ------
  5409.  
  5410.      #include <crt0.h>
  5411.      
  5412.      char **__crt0_glob_function(char *_argument);
  5413.  
  5414. Description
  5415. -----------
  5416.  
  5417. If the application wishes to provide a wildcard expansion function, it
  5418. should define a `__crt0_glob_function' function.  It should return a
  5419. list of the expanded values, or 0 if no expansion will occur.  The
  5420. startup code will free the returned pointer if it is nonzero.
  5421.  
  5422. If no expander function is provided, wildcards will be expanded in the
  5423. POSIX.1 style by the default `__crt0_glob_function' from the C library.
  5424. To disable expansion, provide a `__crt0_glob_function' that always
  5425. returns 0.
  5426.  
  5427. Portability
  5428. -----------
  5429.  
  5430. not ANSI, not POSIX
  5431.  
  5432. 
  5433. File: libc.info,  Node: __crt0_load_environment_file,  Next: __crt0_setup_arguments,  Prev: __crt0_glob_function,  Up: Alphabetical List
  5434.  
  5435. __crt0_load_environment_file
  5436. ============================
  5437.  
  5438. Syntax
  5439. ------
  5440.  
  5441.      #include <crt0.h>
  5442.      
  5443.      void   __crt0_load_environment_file(char *_app_name);
  5444.  
  5445. Description
  5446. -----------
  5447.  
  5448. This function, provided by libc.a, does all the work required to load
  5449. additional environment variables from the file `djgpp.env' whose full
  5450. pathname is given by the `DJGPP' environment variable.  If the
  5451. application does not use environment variables, the programmer can
  5452. reduce the size of the program image by providing a version of this
  5453. function that does nothing.
  5454.  
  5455. *Note __crt0_setup_arguments::.
  5456.  
  5457. Portability
  5458. -----------
  5459.  
  5460. not ANSI, not POSIX
  5461.  
  5462. 
  5463. File: libc.info,  Node: __crt0_setup_arguments,  Next: _crt0_startup_flags,  Prev: __crt0_load_environment_file,  Up: Alphabetical List
  5464.  
  5465. __crt0_setup_arguments
  5466. ======================
  5467.  
  5468. Syntax
  5469. ------
  5470.  
  5471.      #include <crt0.h>
  5472.      
  5473.      void   __crt0_setup_arguments(void);
  5474.  
  5475. Description
  5476. -----------
  5477.  
  5478. This function, provided by libc.a, does all the work required to
  5479. provide the two arguments passed to main() (usually `argc' and `argv').
  5480. If main() does not use these arguments, the programmer can reduce the
  5481. size of the program image by providing a version of this function that
  5482. does nothing.
  5483.  
  5484. Note that since the default `__crt0_setup_arguments_function' will
  5485. *not* expand wildcards inside quotes (`"' or `''), you can quote a part
  5486. of the argument that doesn't include wildcards and still have them
  5487. expanded.  This is so you could use wildcard expansion with filenames
  5488. which have embedded whitespace (on LFN filesystems).
  5489.  
  5490. *Note __crt0_load_environment_file::.
  5491.  
  5492. Portability
  5493. -----------
  5494.  
  5495. not ANSI, not POSIX
  5496.  
  5497. 
  5498. File: libc.info,  Node: _crt0_startup_flags,  Next: cscanf,  Prev: __crt0_setup_arguments,  Up: Alphabetical List
  5499.  
  5500. _crt0_startup_flags
  5501. ===================
  5502.  
  5503. Syntax
  5504. ------
  5505.  
  5506.      #include <crt0.h>
  5507.      
  5508.      int _crt0_startup_flags = ...;
  5509.  
  5510. Description
  5511. -----------
  5512.  
  5513. This variable can be used to determine what the startup code will (or
  5514. will not) do when the program begins.  This can be used to tailor the
  5515. startup environment to a particular program.
  5516.  
  5517. `_CRT0_FLAG_PRESERVE_UPPER_CASE'
  5518.      If set, `argv[0]' is left in whatever case it was.  If not set, all
  5519.      characters are mapped to lower case.  Note that if the `argv0'
  5520.      field in the "stubinfo" structure is present, the case of that part
  5521.      of `argv[0]' is not affected.
  5522.  
  5523. `_CRT0_FLAG_USE_DOS_SLASHES'
  5524.      If set, reverse slashes (dos-style) are preserved in `argv[0]'.  If
  5525.      not set, all reverse slashes are replaced with unix-style slashes.
  5526.  
  5527. `_CRT0_FLAG_DROP_EXE_SUFFIX'
  5528.      If set, the `.exe' suffix is removed from the file name component
  5529.      of `argv[0]'.  If not set, the suffix remains.
  5530.  
  5531. `_CRT0_FLAG_DROP_DRIVE_SPECIFIER'
  5532.      If set, the drive specifier (e.g. `C:') is removed from the
  5533.      beginning of `argv[0]' (if present).  If not set, the drive
  5534.      specifier remains.
  5535.  
  5536. `_CRT0_FLAG_DISALLOW_RESPONSE_FILES'
  5537.      If set, response files (e.g. `@gcc.rf') are not expanded.  If not
  5538.      set, the contents of the response files are used to create
  5539.      arguments.  Note that if the file does not exist, that argument
  5540.      remains unexpanded.
  5541.  
  5542. `_CRT0_FLAG_KEEP_QUOTES'
  5543.      If set, the quote characters `'', `"', and `\' will be retained in
  5544.      `argv[]' elements when processing command lines passed by DOS and
  5545.      via `system'.  This is used by the `redir' program, and should
  5546.      only be needed if you want to get the original command line
  5547.      exactly as it was passed by the caller.
  5548.  
  5549. `_CRT0_FLAG_FILL_SBRK_MEMORY'
  5550.      If set, fill `sbrk''d memory with a constant value.  If not, memory
  5551.      gets whatever happens to have been in there, which breaks some
  5552.      applications.
  5553.  
  5554. `_CRT0_FLAG_FILL_DEADBEEF'
  5555.      If set, fill memory (above) with `0xdeadbeef', else fill with zero.
  5556.      This is especially useful for debugging uninitialized memory
  5557.      problems.
  5558.  
  5559. `_CRT0_FLAG_NEARPTR'
  5560.      If set, set DS limit to 4GB which allows use of near pointers to
  5561.      DOS (and other) memory.  WARNING, disables memory protection and
  5562.      bad pointers may crash the machine or wipe out your data.  This
  5563.      flag is silently ignored on NT and DOSEmu, which disallow such
  5564.      huge selector limits.
  5565.  
  5566. `_CRT0_FLAG_NULLOK'
  5567.      If set, disable NULL pointer protection (if it can be controlled at
  5568.      all).
  5569.  
  5570. `_CRT0_FLAG_NMI_SIGNAL'
  5571.      If set, enabled capture of NMI in exception code.  This may cause
  5572.      problems with laptops and "green" boxes which use it to wake up.
  5573.      Default is to leave NMIs alone and pass through to real mode code.
  5574.      You decide.
  5575.  
  5576. `_CRT0_FLAG_NO_LFN'
  5577.      If set, disable usage of long file name functions even on systems
  5578.      (such as Windows 9X) which support them.  This might be needed to
  5579.      work around program assumptions on file name format on programs
  5580.      written specifically for DOS.  Note that this flag overrides the
  5581.      value of the environment variable `LFN'.
  5582.  
  5583. `_CRT0_FLAG_NONMOVE_SBRK'
  5584.      If set, the `sbrk' algorithm uses multiple DPMI memory blocks which
  5585.      makes sure the base of CS/DS/SS does not change.  This may cause
  5586.      problems with `sbrk(0)' values and programs with other assumptions
  5587.      about `sbrk' behavior.  This flag is useful with near pointers,
  5588.      since a constant pointer to DOS/Video memory can be computed
  5589.      without needing to reload it after any routine which might call
  5590.      `sbrk'.
  5591.  
  5592. `_CRT0_FLAG_UNIX_SBRK'
  5593.      If set, the `sbrk' algorithm resizes memory blocks so that the
  5594.      layout of memory is set up to be the most compatible with Unix
  5595.      `sbrk' expectations.  This mode should not be used with hardware
  5596.      interrupts, near pointers, and may cause problems with QDPMI
  5597.      virtual memory.  On NT, this is the recommended algorithm.
  5598.  
  5599.      If your program requires a specific `sbrk' behavior, you should
  5600.      set either this or the previous flag, since the default may change
  5601.      in different libc releases.
  5602.  
  5603. `_CRT0_FLAG_LOCK_MEMORY'
  5604.      If set, locks all memory as it is allocated.  This effectively
  5605.      disables virtual memory, and may be useful if using extensive
  5606.      hardware interrupt codes in a relatively small image size.  The
  5607.      memory is locked after it is `sbrk''ed, so the locking may fail.
  5608.      This bit may be set or cleared during execution.  When `sbrk' uses
  5609.      multiple memory zones, it can be difficult to lock all memory
  5610.      since the memory block size and location is impossible to
  5611.      determine.
  5612.  
  5613. `_CRT0_FLAG_PRESERVE_FILENAME_CASE'
  5614.      If set, disables all filename letter-case conversions in functions
  5615.      that traverse directories (except findfirst/findnext which always
  5616.      return the filenames exactly as found in the directory entry).
  5617.      When reset, all filenames on 8+3 MSDOS filesystems and DOS-style
  5618.      8+3 filenames on LFN systems are converted to lower-case by
  5619.      functions such as `readdir', `getcwd', `_fixpath' and others.
  5620.      Note that when this flag is set, ALL filenames on MSDOS systems
  5621.      will appear in upper-case, which is both ugly and will break many
  5622.      Unix-born programs.  Use only if you know exactly what you are
  5623.      doing!
  5624.  
  5625.      This flag overrides the value of the environment variable `FNCASE',
  5626.      *Note _preserve_fncase::.
  5627.  
  5628. Portability
  5629. -----------
  5630.  
  5631. not ANSI, not POSIX
  5632.  
  5633. 
  5634. File: libc.info,  Node: cscanf,  Next: ctermid,  Prev: _crt0_startup_flags,  Up: Alphabetical List
  5635.  
  5636. cscanf
  5637. ======
  5638.  
  5639. Syntax
  5640. ------
  5641.  
  5642.      #include <conio.h>
  5643.      
  5644.      int cscanf(const char *_format, ...);
  5645.  
  5646. Description
  5647. -----------
  5648.  
  5649. Like `scanf' (*note scanf::.), but it reads from the standard input
  5650. device directly, avoiding buffering both by DOS and by the library.
  5651. Each character is read by `getche' (*note getche::.).
  5652.  
  5653. Return Value
  5654. ------------
  5655.  
  5656. The number of fields stored.
  5657.  
  5658. Portability
  5659. -----------
  5660.  
  5661. not ANSI, not POSIX
  5662.  
  5663. 
  5664. File: libc.info,  Node: ctermid,  Next: ctime,  Prev: cscanf,  Up: Alphabetical List
  5665.  
  5666. ctermid
  5667. =======
  5668.  
  5669. Syntax
  5670. ------
  5671.  
  5672.      #include <unistd.h>
  5673.      
  5674.      char *ctermid(char *s);
  5675.  
  5676. Description
  5677. -----------
  5678.  
  5679. This function returns the name of the current terminal device. Under
  5680. MS-DOS, this is always "con".
  5681.  
  5682. Return Value
  5683. ------------
  5684.  
  5685. If S is null, returns pointer to internal static string "con".
  5686. Otherwise, copies "con" to buffer pointed by S.
  5687.  
  5688. Portability
  5689. -----------
  5690.  
  5691. not ANSI, POSIX
  5692.  
  5693. 
  5694. File: libc.info,  Node: ctime,  Next: delay,  Prev: ctermid,  Up: Alphabetical List
  5695.  
  5696. ctime
  5697. =====
  5698.  
  5699. Syntax
  5700. ------
  5701.  
  5702.      #include <time.h>
  5703.      
  5704.      char *ctime(const time_t *cal);
  5705.  
  5706. Description
  5707. -----------
  5708.  
  5709. This function returns an ASCII representation of the time in CAL.  This
  5710. is equivalent to `asctime(localtime(cal))'.  *Note asctime::.  *Note
  5711. localtime::.
  5712.  
  5713. Return Value
  5714. ------------
  5715.  
  5716. The ascii representation of the time.
  5717.  
  5718. Portability
  5719. -----------
  5720.  
  5721. ANSI, POSIX
  5722.  
  5723. 
  5724. File: libc.info,  Node: delay,  Next: delline,  Prev: ctime,  Up: Alphabetical List
  5725.  
  5726. delay
  5727. =====
  5728.  
  5729. Syntax
  5730. ------
  5731.  
  5732.      #include <dos.h>
  5733.      
  5734.      void delay(unsigned msec);
  5735.  
  5736. Description
  5737. -----------
  5738.  
  5739. This function causes the program to pause for MSEC milliseconds.  It
  5740. uses the `int 15h' delay function to relinquish the CPU to other
  5741. programs that might need it.
  5742.  
  5743. Some operating systems that emulate DOS, such as OS/2 and Windows/NT,
  5744. hang the DOS session when the <Pause> key is pressed during the call to
  5745. `delay'.  Plain DOS and Windows 3.X and 9X are known to not have this
  5746. bug.
  5747.  
  5748. Return Value
  5749. ------------
  5750.  
  5751. None.
  5752.  
  5753. Portability
  5754. -----------
  5755.  
  5756. not ANSI, not POSIX
  5757.  
  5758. Example
  5759. -------
  5760.  
  5761.      delay(200); /* delay for 1/5 second */
  5762.  
  5763. 
  5764. File: libc.info,  Node: delline,  Next: _detect_80387,  Prev: delay,  Up: Alphabetical List
  5765.  
  5766. delline
  5767. =======
  5768.  
  5769. Syntax
  5770. ------
  5771.  
  5772.      #include <conio.h>
  5773.      
  5774.      void    delline(void);
  5775.  
  5776. Description
  5777. -----------
  5778.  
  5779. The line the cursor is on is deleted; lines below it scroll up.
  5780.  
  5781. Portability
  5782. -----------
  5783.  
  5784. not ANSI, not POSIX
  5785.  
  5786. 
  5787. File: libc.info,  Node: _detect_80387,  Next: difftime,  Prev: delline,  Up: Alphabetical List
  5788.  
  5789. _detect_80387
  5790. =============
  5791.  
  5792. Syntax
  5793. ------
  5794.  
  5795.      #include <dos.h>
  5796.      
  5797.      int _detect_80387(void);
  5798.  
  5799. Description
  5800. -----------
  5801.  
  5802. Detects whether a numeric coprocessor is present.  Note that
  5803. floating-point code will work even without a coprocessor, due to the
  5804. existence of emulation.
  5805.  
  5806. Return Value
  5807. ------------
  5808.  
  5809. 1 if a coprocessor is present, 0 if not.
  5810.  
  5811. Portability
  5812. -----------
  5813.  
  5814. not ANSI, not POSIX
  5815.  
  5816. Example
  5817. -------
  5818.  
  5819.      if (_detect_80387())
  5820.        printf("You have a coprocessor\n");
  5821.  
  5822. 
  5823. File: libc.info,  Node: difftime,  Next: dirname,  Prev: _detect_80387,  Up: Alphabetical List
  5824.  
  5825. difftime
  5826. ========
  5827.  
  5828. Syntax
  5829. ------
  5830.  
  5831.      #include <time.h>
  5832.      
  5833.      double difftime(time_t t1, time_t t0);
  5834.  
  5835. Description
  5836. -----------
  5837.  
  5838. This function returns the difference in time, in seconds, from T0 to T1.
  5839.  
  5840. Return Value
  5841. ------------
  5842.  
  5843. The number of seconds.
  5844.  
  5845. Portability
  5846. -----------
  5847.  
  5848. ANSI, POSIX
  5849.  
  5850. Example
  5851. -------
  5852.  
  5853.      time_t t1, t0;
  5854.      double elapsed;
  5855.      time(&t0);
  5856.      do_something();
  5857.      time(&t1);
  5858.      elapsed = difftime(t1, t0);
  5859.  
  5860. 
  5861. File: libc.info,  Node: dirname,  Next: disable,  Prev: difftime,  Up: Alphabetical List
  5862.  
  5863. dirname
  5864. =======
  5865.  
  5866. Syntax
  5867. ------
  5868.  
  5869.      #include <unistd.h>
  5870.      
  5871.      char * dirname (const char *fname);
  5872.  
  5873. Description
  5874. -----------
  5875.  
  5876. This function returns the directory part of the argument FNAME copied
  5877. to a buffer allocated by calling `malloc'.  The directory part is
  5878. everything up to but not including the rightmost slash (either forward-
  5879. or backslash) in FNAME.  If FNAME includes a drive letter but no
  5880. slashes, the function will return `X:.' where X is the drive letter.
  5881. If FNAME includes neither the drive letter nor any slashes, `"."' will
  5882. be returned.  Trailing slashes are removed from the result, unless it
  5883. is a root directory, with or without a drive letter.
  5884.  
  5885. Return value
  5886. ------------
  5887.  
  5888. The directory part in malloc'ed storage, or a NULL pointer of either
  5889. there's not enough free memory, or FNAME is a NULL pointer.
  5890.  
  5891. Portability
  5892. -----------
  5893.  
  5894. not ANSI, not POSIX
  5895.  
  5896. Example
  5897. -------
  5898.  
  5899.       printf ("The parent of current directory is %s\n",
  5900.               dirname (getcwd (0, PATH_MAX)));
  5901.  
  5902. 
  5903. File: libc.info,  Node: disable,  Next: div,  Prev: dirname,  Up: Alphabetical List
  5904.  
  5905. disable
  5906. =======
  5907.  
  5908. Syntax
  5909. ------
  5910.  
  5911.      #include <dos.h>
  5912.      
  5913.      int disable(void);
  5914.  
  5915. Description
  5916. -----------
  5917.  
  5918. This function disables interrupts.
  5919.  
  5920. *Note enable::.
  5921.  
  5922. Return Value
  5923. ------------
  5924.  
  5925. Returns nonzero if the interrupts had been enabled before this call,
  5926. zero if they were already disabled.
  5927.  
  5928. Portability
  5929. -----------
  5930.  
  5931. not ANSI, not POSIX
  5932.  
  5933. Example
  5934. -------
  5935.  
  5936.      int ints_were_enabled;
  5937.      
  5938.      ints_were_enabled = disable();
  5939.      . . . do some stuff . . .
  5940.      if (ints_were_enabled)
  5941.        enable();
  5942.  
  5943. 
  5944. File: libc.info,  Node: div,  Next: __djgpp_exception_toggle,  Prev: disable,  Up: Alphabetical List
  5945.  
  5946. div
  5947. ===
  5948.  
  5949. Syntax
  5950. ------
  5951.  
  5952.      #include <stdlib.h>
  5953.      
  5954.      div_t div(int numerator, int denominator);
  5955.  
  5956. Description
  5957. -----------
  5958.  
  5959. Returns the quotient and remainder of the division NUMERATOR divided by
  5960. DENOMINATOR.  The return type is as follows:
  5961.  
  5962.      typedef struct {
  5963.        int quot;
  5964.        int rem;
  5965.      } div_t;
  5966.  
  5967. Return Value
  5968. ------------
  5969.  
  5970. The results of the division are returned.
  5971.  
  5972. Portability
  5973. -----------
  5974.  
  5975. ANSI, POSIX
  5976.  
  5977. Example
  5978. -------
  5979.  
  5980.      div_t d = div(42, 3);
  5981.      printf("42 = %d x 3 + %d\n", d.quot, d.rem);
  5982.      
  5983.      div(+40, +3) = { +13, +1 }
  5984.      div(+40, -3) = { -13, -1 }
  5985.      div(-40, +3) = { -13, -1 }
  5986.      div(-40, -3) = { +13, -1 }
  5987.  
  5988. 
  5989. File: libc.info,  Node: __djgpp_exception_toggle,  Next: __djgpp_map_physical_memory,  Prev: div,  Up: Alphabetical List
  5990.  
  5991. __djgpp_exception_toggle
  5992. ========================
  5993.  
  5994. Syntax
  5995. ------
  5996.  
  5997.  
  5998.      #include <sys/exceptn.h>
  5999.      
  6000.      void __djgpp_exception_toggle(void);
  6001.  
  6002. Description
  6003. -----------
  6004.  
  6005. This function is automatically called when the program exits, to restore
  6006. handling of all the exceptions to their normal state.  You may also call
  6007. it from your program, around the code fragments where you need to
  6008. temporarily restore *all* the exceptions to their default handling.
  6009. One example of such case might be a call to a library functions that
  6010. spawn child programs, when you don't want to handle signals generated
  6011. while the child runs (by default, those signals are also passed to the
  6012. parent).
  6013.  
  6014. Portability
  6015. -----------
  6016.  
  6017. not ANSI, not POSIX
  6018.  
  6019. Example
  6020. -------
  6021.  
  6022.  
  6023.        __djgpp_exception_toggle();
  6024.        system("myprog");
  6025.        __djgpp_exception_toggle();
  6026.  
  6027. 
  6028. File: libc.info,  Node: __djgpp_map_physical_memory,  Next: __djgpp_memory_handle,  Prev: __djgpp_exception_toggle,  Up: Alphabetical List
  6029.  
  6030. __djgpp_map_physical_memory
  6031. ===========================
  6032.  
  6033. Syntax
  6034. ------
  6035.  
  6036.      #include <dpmi.h>
  6037.      
  6038.      int __djgpp_map_physical_memory(void *our_addr, unsigned long num_bytes,
  6039.                          unsigned long phys_addr);
  6040.  
  6041. Description
  6042. -----------
  6043.  
  6044. This function attempts to map a range of physical memory over the
  6045. specified addresses.  One common use of this routine is to map device
  6046. memory, such as a linear frame buffer, into the address space of the
  6047. calling program.  OUR_ADDR, NUM_BYTES, and PHYS_ADDR must be
  6048. page-aligned.  If they are not page-aligned, ERRNO will be set to
  6049. `EINVAL' and the routine will fail.
  6050.  
  6051. This routine properly handles memory ranges that span multiple DPMI
  6052. handles, while `__dpmi_map_device_in_memory_block' does not.
  6053.  
  6054. Consult DPMI documentation on function 0508H for details on how this
  6055. function works.  Note: since 0508H is a DPMI service new with DPMI 1.0,
  6056. this call will fail on most DPMI 0.9 servers.  For your program to work
  6057. on a wide range of systems, you should not assume this call will
  6058. succeed.
  6059.  
  6060. Even on failure, this routine may affect a subset of the pages
  6061. specified.
  6062.  
  6063. Return Value
  6064. ------------
  6065.  
  6066. 0 on success, -1 on failure.  On failure, ERRNO will be set to `EINVAL'
  6067. for illegal input parameters, or `EACCES' if the DPMI server rejected
  6068. the mapping request.
  6069.  
  6070. Portability
  6071. -----------
  6072.  
  6073. not ANSI, not POSIX
  6074.  
  6075. Example
  6076. -------
  6077.  
  6078.      if (__djgpp_map_physical_memory (my_page_aligned_memory, 16384, 0x40000000))
  6079.        printf ("Failed to map physical addresses!\n");
  6080.  
  6081. 
  6082. File: libc.info,  Node: __djgpp_memory_handle,  Next: __djgpp_memory_handle_list,  Prev: __djgpp_map_physical_memory,  Up: Alphabetical List
  6083.  
  6084. __djgpp_memory_handle
  6085. =====================
  6086.  
  6087. Syntax
  6088. ------
  6089.  
  6090.      #include <crt0.h>
  6091.      
  6092.      __djgpp_sbrk_handle *__djgpp_memory_handle(unsigned address);
  6093.  
  6094. Description
  6095. -----------
  6096.  
  6097. This function returns a pointer to a structure containing the memory
  6098. handle and program relative offset associated with the address passed.
  6099. It is just a convenient way to process the __djgpp_memory_handle_list.
  6100.  
  6101. Return Value
  6102. ------------
  6103.  
  6104. A pointer to the __djgpp_sbrk_handle associated with a particular
  6105. address.
  6106.  
  6107. Portability
  6108. -----------
  6109.  
  6110. not ANSI, not POSIX
  6111.  
  6112. 
  6113. File: libc.info,  Node: __djgpp_memory_handle_list,  Next: __djgpp_nearptr_disable,  Prev: __djgpp_memory_handle,  Up: Alphabetical List
  6114.  
  6115. __djgpp_memory_handle_list
  6116. ==========================
  6117.  
  6118. Syntax
  6119. ------
  6120.  
  6121.      #include <crt0.h>
  6122.      
  6123.      extern __djgpp_sbrk_handle __djgpp_memory_handle_list[256];
  6124.  
  6125. Description
  6126. -----------
  6127.  
  6128. This array contains a list of memory handles and program relative
  6129. offsets allocated by sbrk() in addition to the handle allocated by the
  6130. stub.  These values are normally not needed unless you are doing
  6131. low-level DPMI page protection or memory mapping.
  6132.  
  6133. Portability
  6134. -----------
  6135.  
  6136. not ANSI, not POSIX
  6137.  
  6138. 
  6139. File: libc.info,  Node: __djgpp_nearptr_disable,  Next: __djgpp_nearptr_enable,  Prev: __djgpp_memory_handle_list,  Up: Alphabetical List
  6140.  
  6141. __djgpp_nearptr_disable
  6142. =======================
  6143.  
  6144. Syntax
  6145. ------
  6146.  
  6147.      #include <sys/nearptr.h>
  6148.      
  6149.      void __djgpp_nearptr_disable(void);
  6150.  
  6151. Description
  6152. -----------
  6153.  
  6154. This function disables near pointers, and re-enables protection.  *Note
  6155. __djgpp_nearptr_enable::.
  6156.  
  6157. Portability
  6158. -----------
  6159.  
  6160. not ANSI, not POSIX
  6161.  
  6162. 
  6163. File: libc.info,  Node: __djgpp_nearptr_enable,  Next: __djgpp_set_ctrl_c,  Prev: __djgpp_nearptr_disable,  Up: Alphabetical List
  6164.  
  6165. __djgpp_nearptr_enable
  6166. ======================
  6167.  
  6168. Syntax
  6169. ------
  6170.  
  6171.      #include <sys/nearptr.h>
  6172.      
  6173.      int __djgpp_nearptr_enable(void);
  6174.  
  6175. Description
  6176. -----------
  6177.  
  6178. This function enables "near pointers" to be used to access the DOS
  6179. memory arena.  Sort of.  When you call this function, it will return
  6180. nonzero if it has successfully enabled near pointers.  If so, you must
  6181. add the value `__djgpp_conventional_base' to the linear address of the
  6182. physical memory.  For example:
  6183.  
  6184.      if (__djgpp_nearptr_enable())
  6185.      {
  6186.        short *screen = (short *)(__djgpp_conventional_base + 0xb8000);
  6187.        for (i=0; i<80*24*2; i++)
  6188.          screen[i] = 0x0720;
  6189.        __djgpp_nearptr_disable();
  6190.      }
  6191.  
  6192. The variable `__djgpp_base_address' contains the linear base address of
  6193. the application's data segment.  You can subtract this value from other
  6194. linear addresses that DPMI functions might return in order to obtain a
  6195. near pointer to those linear regions as well.
  6196.  
  6197. If using the Unix-like sbrk algorithm, near pointers are only valid
  6198. until the next `malloc', `system', `spawn*', or `exec*' function call,
  6199. since the linear base address of the application may be changed by
  6200. these calls.
  6201.  
  6202. WARNING: When you enable near pointers, you disable all the protection
  6203. that the system is providing.  If you are not careful, your application
  6204. may destroy the data in your computer.  USE AT YOUR OWN RISK!
  6205.  
  6206. Return Value
  6207. ------------
  6208.  
  6209. Returns 0 if near pointers are not available, or nonzero if they are.
  6210.  
  6211. Portability
  6212. -----------
  6213.  
  6214. not ANSI, not POSIX
  6215.  
  6216. 
  6217. File: libc.info,  Node: __djgpp_set_ctrl_c,  Next: __djgpp_set_page_attributes,  Prev: __djgpp_nearptr_enable,  Up: Alphabetical List
  6218.  
  6219. __djgpp_set_ctrl_c
  6220. ==================
  6221.  
  6222. Syntax
  6223. ------
  6224.  
  6225.      #include <sys/exceptn.h>
  6226.      
  6227.      int __djgpp_set_ctrl_c(int enable);
  6228.  
  6229. Description
  6230. -----------
  6231.  
  6232. This function sets and resets the bit which controls whether signals
  6233. `SIGINT' and `SIGQUIT' (*note signal::.) will be raised when you press
  6234. the INTR or QUIT keys.  By default these generate signals which, if
  6235. uncaught by a signal handler, will abort your program.  However, when
  6236. you call the `setmode' library function to switch the console reads to
  6237. binary mode, or open the console in binary mode for reading, this
  6238. generation of signals is turned off, because some programs want to get
  6239. the `^C' and `^\' characters as any other character and handle them by
  6240. themselves.
  6241.  
  6242. `__djgpp_set_ctrl_c' lets you explicitly determine the effect of INTR
  6243. and QUIT keys.  When called with a non-zero, positive value of ENABLE,
  6244. it arranges for `SIGINT' and `SIGQUIT' signals to be generated when the
  6245. appropriate key is pressed; if you call it with a zero in ENABLE, these
  6246. keys are treated as normal characters.  If ENABLE is negative,
  6247. `__djgpp_set_ctrl_c' returns the current state of the signal
  6248. generation, but doesn't change it.
  6249.  
  6250. For getting similar effects via the POSIX `termios' functions, see
  6251. *Note tcsetattr::.
  6252.  
  6253. Note that the effect of `Ctrl-<BREAK>' key is unaffected by this
  6254. function; use the `_go32_want_ctrl_break' library function to control
  6255. it.
  6256.  
  6257. Also note that in DJGPP, the effect of the interrupt signal will only be
  6258. seen when the program is in protected mode (*Note Signal Mechanism:
  6259. signal, for more details).  Thus, if you press `Ctrl-C' while your
  6260. program calls DOS (e.g., when reading from the console), the `SIGINT'
  6261. signal handler will only be called after that call returns.
  6262.  
  6263. Return Value
  6264. ------------
  6265.  
  6266. The state of `SIGINT' and `SIGQUIT' generation before the call: 0 if it
  6267. was disabled, 1 if it was enabled.  If the argument ENABLE is negative,
  6268. the state is not altered.
  6269.  
  6270. Portability
  6271. -----------
  6272.  
  6273. not ANSI, not POSIX
  6274.  
  6275. Example
  6276. -------
  6277.  
  6278.  
  6279.        setmode(fileno(stdin), O_BINARY);
  6280.        if (isatty(fileno(stdin)));
  6281.          __djgpp_set_ctrl_c(1);
  6282.  
  6283. 
  6284. File: libc.info,  Node: __djgpp_set_page_attributes,  Next: __djgpp_set_sigint_key,  Prev: __djgpp_set_ctrl_c,  Up: Alphabetical List
  6285.  
  6286. __djgpp_set_page_attributes
  6287. ===========================
  6288.  
  6289. Syntax
  6290. ------
  6291.  
  6292.      #include <dpmi.h>
  6293.      
  6294.      int __djgpp_set_page_attributes(void *our_addr, unsigned long num_bytes,
  6295.                          unsigned short attributes);
  6296.  
  6297. Description
  6298. -----------
  6299.  
  6300. This function sets the DPMI page attributes for the pages in a range of
  6301. memory.  OUR_ADDR and NUM_BYTES must be page-aligned.  If they are not
  6302. page-aligned, ERRNO will be set to `EINVAL' and the routine will fail.
  6303.  
  6304. Consult DPMI documentation on function 0507H for the meaning of the
  6305. ATTRIBUTES argument.  Note: since 0507H is a DPMI service new with DPMI
  6306. 1.0, this call will fail on most DPMI 0.9 servers.  For your program to
  6307. work on a wide range of systems, you should not assume this call will
  6308. succeed.
  6309.  
  6310. Even on failure, this routine may affect a subset of the pages
  6311. specified.
  6312.  
  6313. Return Value
  6314. ------------
  6315.  
  6316. 0 on success, -1 on failure.  On failure, ERRNO will be set to `EINVAL'
  6317. for illegal input parameters, or `EACCES' if the DPMI server rejected
  6318. the attribute setting.
  6319.  
  6320. Portability
  6321. -----------
  6322.  
  6323. not ANSI, not POSIX
  6324.  
  6325. Example
  6326. -------
  6327.  
  6328.      if (__djgpp_set_page_attributes (my_page_aligned_memory, 16384, 0))
  6329.        printf ("Failed to make pages uncommitted!\n");
  6330.  
  6331. 
  6332. File: libc.info,  Node: __djgpp_set_sigint_key,  Next: __djgpp_set_sigquit_key,  Prev: __djgpp_set_page_attributes,  Up: Alphabetical List
  6333.  
  6334. __djgpp_set_sigint_key
  6335. ======================
  6336.  
  6337. Syntax
  6338. ------
  6339.  
  6340.  
  6341.      #include <sys/exceptn.h>
  6342.      
  6343.      void __djgpp_set_sigint_key(int new_key);
  6344.  
  6345. Description
  6346. -----------
  6347.  
  6348. This function changes the INTR key that generates the signal `SIGINT'.
  6349. By default, `Ctrl-C' is set as the INTR key.  To replace it with
  6350. another key, put the *scan code* of the new INTR key into the bits 0-7
  6351. and the required keyboard status byte into bits 8-15 of NEW_KEY, and
  6352. call this function.  Here's how the keyboard status bits are defined:
  6353.  
  6354.  
  6355.         Bit
  6356.       76543210    Meaning
  6357.      
  6358.       .......X    Right Shift key
  6359.       ......X.    Left Shift key
  6360.       .....X..    Ctrl key
  6361.       ....X...    Alt key
  6362.       ...X....    Scroll Lock key
  6363.       ..X.....    Num Lock key
  6364.       .X......    Caps Lock key
  6365.       X.......    Insert
  6366.  
  6367. A 1 in any of the above bits means that the corresponding key should be
  6368. pressed; a zero means it should be released.  Currently, all but the
  6369. lower 4 bits are always ignored by the DJGPP keyboard handler when you
  6370. set the INTR key using this function.
  6371.  
  6372. For example, the default `Ctrl-C' key should be passed as `0x042e',
  6373. since the scan code of the <C> key is 2Eh, and when the <Ctrl> key is
  6374. pressed, the keyboard status byte is 04h.
  6375.  
  6376. To disable `SIGINT' generation, pass zero as the argument (since no key
  6377. has a zero scan code).
  6378.  
  6379. This function will set things up so that the left <Shift> key doesn't
  6380. affect Ctrl- and Alt-modified keys; the right <Shift> key won't affect
  6381. them either, unless its bit is explicitly set in NEW_KEY.  This means
  6382. that `Ctrl-C' and `Ctrl-c' will both trigger `SIGINT' if `0x042e' is
  6383. passed to this function.
  6384.  
  6385. The DJGPP built-in keyboard handler pretends that when the right
  6386. <Shift> key is pressed, so is the left <Shift> key (but not vice versa).
  6387.  
  6388. For getting similar effects via the POSIX `termios' functions, see
  6389. *Note tcsetattr::.
  6390.  
  6391. Return Value
  6392. ------------
  6393.  
  6394. The previous INTR key (scan code in bits 0-7, keyboad status in bits
  6395. 8-15).
  6396.  
  6397. Portability
  6398. -----------
  6399.  
  6400. not ANSI, not POSIX
  6401.  
  6402. Example
  6403. -------
  6404.  
  6405.  
  6406.        __djgpp_set_sigint_key(0x0422);  /* make Ctrl-g generate SIGINT's */
  6407.  
  6408. 
  6409. File: libc.info,  Node: __djgpp_set_sigquit_key,  Next: __djgpp_share_flags,  Prev: __djgpp_set_sigint_key,  Up: Alphabetical List
  6410.  
  6411. __djgpp_set_sigquit_key
  6412. =======================
  6413.  
  6414. Syntax
  6415. ------
  6416.  
  6417.  
  6418.      #include <sys/exceptn.h>
  6419.      
  6420.      void __djgpp_set_sigquit_key(int new_key);
  6421.  
  6422. Description
  6423. -----------
  6424.  
  6425. This function changes the QUIT key that generates the signal `SIGQUIT'.
  6426. By default, `Ctrl-\' is set as the QUIT key.  To replace it with
  6427. another key, put the *scan code* of the new QUIT key into the bits 0-7
  6428. and the required keyboard status byte into bits 8-15 of NEW_KEY, and
  6429. call this function.  Here's how the keyboard status bits are defined:
  6430.  
  6431.  
  6432.         Bit
  6433.       76543210    Meaning
  6434.      
  6435.       .......X    Right Shift key
  6436.       ......X.    Left Shift key
  6437.       .....X..    Ctrl key
  6438.       ....X...    Alt key
  6439.       ...X....    Scroll Lock key
  6440.       ..X.....    Num Lock key
  6441.       .X......    Caps Lock key
  6442.       X.......    Insert
  6443.  
  6444. A 1 in any of the above bits means that the corresponding key should be
  6445. pressed; a zero means it should be released.  Currently, all but the
  6446. lower 4 bits are always ignored by the DJGPP keyboard handler when you
  6447. set the QUIT key with this function.
  6448.  
  6449. For example, the default `Ctrl-\' key should be passed as `0x042b',
  6450. since the scan code of `\' is 2Bh and when the <Ctrl> key is pressed,
  6451. the keyboard status byte is 04h.
  6452.  
  6453. To disable `SIGQUIT' generation, pass zero as the argument (since no
  6454. key has a zero scan code).
  6455.  
  6456. This function will set things up so that the left <Shift> key doesn't
  6457. affect Ctrl- and Alt-modified keys; the right <Shift> key won't affect
  6458. them either, unless its bit is explicitly set in NEW_KEY.  This means
  6459. that `Ctrl-\' and `Ctrl-|' will both trigger `SIGQUIT' if `0x042b' is
  6460. passed to this function.
  6461.  
  6462. The DJGPP built-in keyboard handler pretends that when the right
  6463. <Shift> key is pressed, so is the left <Shift> key (but not vice versa).
  6464.  
  6465. For getting similar effects via the POSIX `termios' functions, see
  6466. *Note tcsetattr::.
  6467.  
  6468. Return Value
  6469. ------------
  6470.  
  6471. The previous QUIT key (scan code in bits 0-7, keyboad status in bits
  6472. 8-15).
  6473.  
  6474. Portability
  6475. -----------
  6476.  
  6477. not ANSI, not POSIX
  6478.  
  6479. Example
  6480. -------
  6481.  
  6482.  
  6483.        __djgpp_set_sigint_key(0);  /* disable SIGQUIT's */
  6484.  
  6485. 
  6486. File: libc.info,  Node: __djgpp_share_flags,  Next: __djgpp_traceback_exit,  Prev: __djgpp_set_sigquit_key,  Up: Alphabetical List
  6487.  
  6488. __djgpp_share_flags
  6489. ===================
  6490.  
  6491. Syntax
  6492. ------
  6493.  
  6494.      #include <fcntl.h>
  6495.      
  6496.      int __djgpp_share_flags = ...;
  6497.  
  6498. Description
  6499. -----------
  6500.  
  6501. This variable controls the share flags used by `open' (and hence
  6502. `fopen') when opening a file.
  6503.  
  6504. If you assign any value other than 0 to this variable libc will use
  6505. that value for the sharing bits when if calls DOS to open the file.
  6506. But if you specify any share flag in the `open' call then these flags
  6507. will remain untouched. In this way `__djgpp_share_flags' acts just like
  6508. a default and by default is 0 ensuring maximum compatibility with older
  6509. versions of djgpp.
  6510.  
  6511. If you don't know how the share flags act consult any DOS reference.
  6512. They allow to share or protect a file when it's opened more than once
  6513. by the same task or by two or more tasks. The exact behavior depends on
  6514. the exact case. One interesting thing is that when the file is opened
  6515. by two tasks under Windows the results are different if you use Windows
  6516. 3.1 or Windows 95.  To add even more complexity Windows 3.1 is affected
  6517. by `SHARE.EXE'.
  6518.  
  6519. The available flags are:
  6520.  
  6521. `SH_COMPAT    0x0000'
  6522.      That's the compatible mode.
  6523.  
  6524. `SH_DENYRW    0x0010'
  6525.      Deny read and deny write.
  6526.  
  6527. `SH_DENYWR    0x0020'
  6528.      Deny write.
  6529.  
  6530. `SH_DENYRD    0x0030'
  6531.      Deny read.
  6532.  
  6533. `SH_DENYNO    0x0040'
  6534.      No deny.
  6535.  
  6536. Of course these flags are DOS specific and doesn't exist under other
  6537. OSs; and as you can imagine `__djgpp_share_flags' is djgpp specific.
  6538.  
  6539. *Note open::.  *Note fopen::.
  6540.  
  6541. Portability
  6542. -----------
  6543.  
  6544. not ANSI, not POSIX
  6545.  
  6546. 
  6547. File: libc.info,  Node: __djgpp_traceback_exit,  Next: _djstat_describe_lossage,  Prev: __djgpp_share_flags,  Up: Alphabetical List
  6548.  
  6549. __djgpp_traceback_exit
  6550. ======================
  6551.  
  6552. Syntax
  6553. ------
  6554.  
  6555.  
  6556.      #include <signal.h>
  6557.      
  6558.      void __djgpp_traceback_exit(int signo);
  6559.  
  6560. Description
  6561. -----------
  6562.  
  6563. This function is a signal handler which will print a traceback and abort
  6564. the program.  It is called by default by the DJGPP signal-handling code
  6565. when any signal except `SIGQUIT' is raised (`SIGQUIT' is by default
  6566. discarded).
  6567.  
  6568. You can use this function to get the Unix behavior of aborting the
  6569. program on `SIGQUIT' (see the example below).
  6570.  
  6571. When this function is called directly, pass the signal number as its
  6572. SIGNO argument.
  6573.  
  6574. Portability
  6575. -----------
  6576.  
  6577. not ANSI, not POSIX
  6578.  
  6579. Example
  6580. -------
  6581.  
  6582.        signal(SIGQUIT, __djgpp_traceback_exit);
  6583.  
  6584. 
  6585. File: libc.info,  Node: _djstat_describe_lossage,  Next: _djstat_fail_bits,  Prev: __djgpp_traceback_exit,  Up: Alphabetical List
  6586.  
  6587. _djstat_describe_lossage
  6588. ========================
  6589.  
  6590. Syntax
  6591. ------
  6592.  
  6593.      #include <stdio.h>
  6594.      
  6595.      void _djstat_describe_lossage(FILE *fp);
  6596.  
  6597. Description
  6598. -----------
  6599.  
  6600. Accesses the global variable *Note _djstat_fail_bits:: and prints to the
  6601. stream given by FP a human-readable description of the undocumented DOS
  6602. features which the last call to `stat()' or `fstat()' failed to use.
  6603. (If FP is zero, the function prints to stderr.)  If the last call to
  6604. `f?stat()' didn't set any failure bits, an "all's well" message is
  6605. printed.  This function is designed to help in debugging these
  6606. functions in hostile environments (like DOS clones) and in adapting
  6607. them to the future DOS versions.  If you ever have any strange results
  6608. returned by `f?stat()', please call this function and post the
  6609. diagnostics it printed to the DJGPP mailing list.
  6610.  
  6611. The diagnostic messages this function prints are almost
  6612. self-explanatory.  Some explanations of terminology and abbreviations
  6613. used by the printed messages will further clarify them.
  6614.  
  6615. SDA ("Swappable DOS Area") - this is an internal DOS structure.
  6616. `stat()' uses it to get the full directory entry (including the
  6617. starting cluster number) of a file.  The pointer to SDA found by
  6618. `stat()' is trusted only if we find the pathname of our file at a
  6619. specific offset in that SDA.
  6620.  
  6621. SFT ("System File Table") - another internal DOS structure, used in
  6622. file operations.  `fstat()' uses it to get full information on a file
  6623. given its handle.  An SFT entry which is found by `fstat()' is only
  6624. trusted if it contains files size and time stamp like those returned by
  6625. DOS functions 57h and 42h.  Novell NetWare 3.x traps DOS file
  6626. operations in such a way they never get to SFT, so some failure
  6627. messages refer specifically to Novell.
  6628.  
  6629. Hashing - the fall-back method of returning a unique inode number for
  6630. each file.  It is used whenever the starting cluster of a file couldn't
  6631. be reliably determined.
  6632.  
  6633. Return Value
  6634. ------------
  6635.  
  6636. None.
  6637.  
  6638. Portability
  6639. -----------
  6640.  
  6641. not ANSI, not POSIX
  6642.  
  6643. Example
  6644. -------
  6645.  
  6646.        if (stat(path, &stat_buf))
  6647.          _djstat_describe_lossage((FILE *)0);
  6648.  
  6649. 
  6650. File: libc.info,  Node: _djstat_fail_bits,  Next: _djstat_flags,  Prev: _djstat_describe_lossage,  Up: Alphabetical List
  6651.  
  6652. _djstat_fail_bits
  6653. =================
  6654.  
  6655. Syntax
  6656. ------
  6657.  
  6658.      #include <sys/stat.h>
  6659.      
  6660.      extern unsigned short   _djstat_fail_bits;
  6661.  
  6662. As proper operation of `stat' (*note stat::.) and `fstat' (*note
  6663. fstat::.) depend on undocumented DOS features, they could fail in some
  6664. incompatible environment or a future DOS version.  If they do, the
  6665. `_djstat_fail_bits' variable will have some of its bits set.  Each bit
  6666. describes a single feature which was used and failed.  The function
  6667. *Note _djstat_describe_lossage:: may be called to print a human-readable
  6668. description of the bits which were set by the last call to `f?stat'.
  6669. This should make debugging `f?stat' failures in an unanticipated
  6670. environment a lot easier.
  6671.  
  6672. The following bits are currently defined:
  6673.  
  6674. `_STFAIL_SDA'
  6675.      Indicates that Get SDA call failed.
  6676.  
  6677. `_STFAIL_OSVER'
  6678.      Indicates an unsupported DOS version (less than 3.10 for `stat' or
  6679.      less than 2.0 for `fstat').
  6680.  
  6681. `_STFAIL_BADSDA'
  6682.      The pointer to SDA was found to be bogus.
  6683.  
  6684. `_STFAIL_TRUENAME'
  6685.      Indicates that `_truename' (*note _truename::.) function call
  6686.      failed.
  6687.  
  6688. `_STFAIL_HASH'
  6689.      Indicates that the starting cluster of the file is unavailable,
  6690.      and inode number was computed by hashing its name.
  6691.  
  6692. `_STFAIL_LABEL'
  6693.      The application requested the time stamp of a root dir, but no
  6694.      volume label was found.
  6695.  
  6696. `_STFAIL_DCOUNT'
  6697.      The number of SDA reported is ridiculously large (probably an
  6698.      unsupported DOS clone).
  6699.  
  6700. `_STFAIL_WRITEBIT'
  6701.      `fstat' was asked to get write access bit of a file, but couldn't.
  6702.  
  6703. `_STFAIL_DEVNO'
  6704.      `fstat' failed to get device number.
  6705.  
  6706. `_STFAIL_BADSFT'
  6707.      An SFT entry for this file was found by `fstat', but its contents
  6708.      can't be trusted because it didn't match file size and time stamp
  6709.      as reported by DOS.
  6710.  
  6711. `_STFAIL_SFTIDX'
  6712.      The SFT index in Job File Table in program's PSP is negative.
  6713.  
  6714. `_STFAIL_SFTNF'
  6715.      The file entry was not found in the SFT array.
  6716.  
  6717. Below are some explanations of terminology and abbreviations used by the
  6718. printed messages, which will further clarify the meaning of the above
  6719. bits and their descriptions printed by `_djstat_describe_lossage'
  6720. (*note _djstat_describe_lossage::.).
  6721.  
  6722. SDA ("Swappable Data Area") - this is an internal DOS structure.
  6723. `stat' uses it to get the full directory entry (including the starting
  6724. cluster number) of a file.  The pointer to SDA found by `stat' is
  6725. trusted only if we find the pathname of our file at a specific offset
  6726. in that SDA.
  6727.  
  6728. SFT ("System File Table") - another internal DOS structure, used in
  6729. file operations.  `fstat' uses it to get full information on a file
  6730. given its handle.  An SFT entry which is found by `fstat' is only
  6731. trusted if it contains files size and time stamp like those returned by
  6732. DOS functions 57h and 42h.  Novell NetWare 3.x traps DOS file operations
  6733. in such a way they never get to SFT, so some failure messages refer
  6734. specifically to Novell.
  6735.  
  6736. Hashing - the fall-back method of returning a unique inode number for
  6737. each file.  It is used whenever the starting cluster of a file couldn't
  6738. be reliably determined.  The full pathname of the file is looked up in a
  6739. table of files seen earlier (hashing is used to speed the lookup
  6740. process).  If found, the inode from the table is returned; this ensures
  6741. that a given file will get the same inode number.  Otherwise a new inode
  6742. number is invented, recorded in the table and returned to caller.
  6743.  
  6744. Portability
  6745. -----------
  6746.  
  6747. not ANSI, not POSIX
  6748.  
  6749. 
  6750. File: libc.info,  Node: _djstat_flags,  Next: _doprnt,  Prev: _djstat_fail_bits,  Up: Alphabetical List
  6751.  
  6752. _djstat_flags
  6753. =============
  6754.  
  6755. Syntax
  6756. ------
  6757.  
  6758.      #include <sys/stat.h>
  6759.      
  6760.      extern unsigned short   _djstat_flags;
  6761.  
  6762. This variable contains bits for some fields of `struct stat' which are
  6763. expensive to compute under DOS.  Any such computation is only done by
  6764. `stat' (*note stat::.) or `fstat' (*note fstat::.) if the corresponding
  6765. bit in `_djstat_flags' is *cleared*.  By default, all the bits are
  6766. cleared, so applications which don't care, automagically get a full
  6767. version, possibly at a price of performance.  To get the fastest
  6768. possible version for your application, clear only the bits which you
  6769. need and set all the others.
  6770.  
  6771. The following bits are currently defined:
  6772.  
  6773. `_STAT_INODE'
  6774.      Causes `stat' and `fstat' to compute the `st_ino' (inode number)
  6775.      field.
  6776.  
  6777. `_STAT_EXEC_EXT'
  6778.      Tells `stat' and `fstat' to compute the execute access bit from
  6779.      the file-name extension.  `stat' and `fstat' know about many
  6780.      popular file-name extensions, to speed up the computation of the
  6781.      execute access bit.
  6782.  
  6783. `_STAT_EXEC_MAGIC'
  6784.      Tells `stat' and `fstat' to compute the execute access bit from
  6785.      magic signature (the first two bytes of the file), see *Note
  6786.      _is_executable::, if the file-name extension is not enough for
  6787.      this.
  6788.  
  6789.      Computing the execute access bit from the magic signature is by
  6790.      far the most expensive part of `stat' and `fstat' (because it
  6791.      requires to read the first two bytes of every file).  If your
  6792.      application doesn't care about execute access bit, setting
  6793.      `_STAT_EXEC_MAGIC' will significantly speed it up.
  6794.  
  6795.      Note that if `_STAT_EXEC_MAGIC' is set, but `_STAT_EXEC_EXT' is
  6796.      not, some files which shouldn't be flagged as executables (e.g.,
  6797.      COFF `*.o' object files) will have their execute bit set, because
  6798.      they have the magic number signature at their beginning.
  6799.      Therefore, only use the above combination if you want to debug the
  6800.      list of extensions provided in `is_exec.c' file.
  6801.  
  6802. `_STAT_DIRSIZE'
  6803.      Causes `stat' to compute directory size by counting the number of
  6804.      its entries (unless some friendly network redirector brought a
  6805.      true directory size with it).  Also computes the number of
  6806.      subdirectories and sets the number of links `st_nlink' field.
  6807.  
  6808.      This computation is also quite expensive, especially for
  6809.      directories with large sub-directories.  If your application
  6810.      doesn't care about size of directories and the `st_nlink' member,
  6811.      you should set the `_STAT_DIRSIZE' bit in `_djstat_flags'.
  6812.  
  6813. `_STAT_ROOT_TIME'
  6814.      Causes `stat' to try to get time stamp of root directory from its
  6815.      volume label entry, if there is one.
  6816.  
  6817. `_STAT_WRITEBIT'
  6818.      Tells `fstat' that file's write access bit is required (this needs
  6819.      special treatment only under some versions of Novell Netware).
  6820.  
  6821. Note that if you set a bit, some failure bits in `_djstat_fail_bits'
  6822. (*note _djstat_fail_bits::.) might not be set, because some
  6823. computations which report failures are only done when they are required.
  6824.  
  6825. Portability
  6826. -----------
  6827.  
  6828. not ANSI, not POSIX
  6829.  
  6830. 
  6831. File: libc.info,  Node: _doprnt,  Next: _dos_close,  Prev: _djstat_flags,  Up: Alphabetical List
  6832.  
  6833. _doprnt
  6834. =======
  6835.  
  6836. Syntax
  6837. ------
  6838.  
  6839.      #include <stdio.h>
  6840.      
  6841.      int _doprnt(const char *format, void *params, FILE *file);
  6842.  
  6843. Description
  6844. -----------
  6845.  
  6846. This is an internal function that is used by all the `printf' style
  6847. functions, which simply pass their format, arguments, and stream to this
  6848. function.
  6849.  
  6850. *Note printf::, for a discussion of the allowed formats and arguments.
  6851.  
  6852. Return Value
  6853. ------------
  6854.  
  6855. The number of characters generated is returned.
  6856.  
  6857. Portability
  6858. -----------
  6859.  
  6860. not ANSI, not POSIX
  6861.  
  6862. Example
  6863. -------
  6864.  
  6865.      int args[] = { 1, 2, 3, 66 };
  6866.      _doprnt("%d %d %d %c\n", args, stdout);
  6867.  
  6868. 
  6869. File: libc.info,  Node: _dos_close,  Next: _dos_commit,  Prev: _doprnt,  Up: Alphabetical List
  6870.  
  6871. _dos_close
  6872. ==========
  6873.  
  6874. Syntax
  6875. ------
  6876.  
  6877.      #include <dos.h>
  6878.      
  6879.      unsigned int _dos_close(int handle);
  6880.  
  6881. Description
  6882. -----------
  6883.  
  6884. This is a direct connection to the MS-DOS close function call (%ah =
  6885. 0x3E).  This function closes the specified file.
  6886.  
  6887. *Note _dos_open::. *Note _dos_creat::. *Note _dos_creatnew::.  *Note
  6888. _dos_read::. *Note _dos_write::.
  6889.  
  6890. Return Value
  6891. ------------
  6892.  
  6893. Returns 0 if successful or DOS error code on error (and sets ERRNO).
  6894.  
  6895. Portability
  6896. -----------
  6897.  
  6898. not ANSI, not POSIX
  6899.  
  6900. Example
  6901. -------
  6902.  
  6903.      int handle;
  6904.      
  6905.      _dos_creat("FOO.DAT", _A_ARCH, &handle);
  6906.      ...
  6907.      _dos_close(handle);
  6908.  
  6909. 
  6910. File: libc.info,  Node: _dos_commit,  Next: _dos_creat,  Prev: _dos_close,  Up: Alphabetical List
  6911.  
  6912. _dos_commit
  6913. ===========
  6914.  
  6915. Syntax
  6916. ------
  6917.  
  6918.      #include <dos.h>
  6919.      
  6920.      unsigned int _dos_commit(int handle);
  6921.  
  6922. Description
  6923. -----------
  6924.  
  6925. This is a direct connection to the MS-DOS commit function call (%ah =
  6926. 0x68).  This function flushes DOS internal file buffers to disk.
  6927.  
  6928. Return Value
  6929. ------------
  6930.  
  6931. Returns 0 if successful or DOS error code on error (and sets ERRNO).
  6932.  
  6933. Portability
  6934. -----------
  6935.  
  6936. not ANSI, not POSIX
  6937.  
  6938. Example
  6939. -------
  6940.  
  6941.      _dos_write(handle, buffer, 1000, &result);
  6942.      _dos_commit(handle);
  6943.      _dos_close(handle);
  6944.  
  6945. 
  6946. File: libc.info,  Node: _dos_creat,  Next: _dos_creatnew,  Prev: _dos_commit,  Up: Alphabetical List
  6947.  
  6948. _dos_creat
  6949. ==========
  6950.  
  6951. Syntax
  6952. ------
  6953.  
  6954.      #include <dos.h>
  6955.      
  6956.      unsigned int _dos_creat(const char *filename, unsigned short attr, int *handle);
  6957.  
  6958. Description
  6959. -----------
  6960.  
  6961. This is a direct connection to the MS-DOS creat function call (%ah =
  6962. 0x3C).  This function creates the given file with the given attribute
  6963. and puts file handle into HANDLE if creating is successful. If the file
  6964. already exists it truncates the file to zero length. Meaning of ATTR
  6965. parameter is the following:
  6966.  
  6967. `_A_NORMAL (0x00)'
  6968.      Normal file (no read/write restrictions)
  6969.  
  6970. `_A_RDONLY (0x01)'
  6971.      Read only file
  6972.  
  6973. `_A_HIDDEN (0x02)'
  6974.      Hidden file
  6975.  
  6976. `_A_SYSTEM (0x04)'
  6977.      System file
  6978.  
  6979. `_A_ARCH (0x20)'
  6980.      Archive file
  6981.  
  6982. See also *Note _dos_open::, *Note _dos_creatnew::, *Note _dos_read::,
  6983. *Note _dos_write::, and *Note _dos_close::.
  6984.  
  6985. This function does not support long filenames, even on systems where the
  6986. LFN API (*note LFN: _use_lfn.) is available.  For LFN-aware functions
  6987. with similar functionality see *Note _creat::, and *Note _creatnew::.
  6988. Also see *Note creat::, and *Note open::, which are Posix-standard.
  6989.  
  6990. Return Value
  6991. ------------
  6992.  
  6993. Returns 0 if successful or DOS error code on error (and sets ERRNO)
  6994.  
  6995. Portability
  6996. -----------
  6997.  
  6998. not ANSI, not POSIX
  6999.  
  7000. Example
  7001. -------
  7002.  
  7003.      int handle;
  7004.      
  7005.      if ( !_dos_creat("FOO.DAT", _A_ARCH, &handle) )
  7006.         puts("Creating was successful !");
  7007.  
  7008. 
  7009. File: libc.info,  Node: _dos_creatnew,  Next: _dos_findfirst,  Prev: _dos_creat,  Up: Alphabetical List
  7010.  
  7011. _dos_creatnew
  7012. =============
  7013.  
  7014. Syntax
  7015. ------
  7016.  
  7017.      #include <dos.h>
  7018.      
  7019.      unsigned int _dos_creatnew(const char *filename, unsigned short attr, int *handle);
  7020.  
  7021. Description
  7022. -----------
  7023.  
  7024. This is a direct connection to the MS-DOS create unique function call
  7025. (%ah = 0x5B).  This function creates the given file with the given
  7026. attribute and puts file handle into HANDLE if creating is successful.
  7027. This function will fail if the specified file exists.  Meaning of ATTR
  7028. parameter is the following:
  7029.  
  7030. `_A_NORMAL (0x00)'
  7031.      Normal file (no read/write restrictions)
  7032.  
  7033. `_A_RDONLY (0x01)'
  7034.      Read only file
  7035.  
  7036. `_A_HIDDEN (0x02)'
  7037.      Hidden file
  7038.  
  7039. `_A_SYSTEM (0x04)'
  7040.      System file
  7041.  
  7042. `_A_ARCH (0x20)'
  7043.      Archive file
  7044.  
  7045. See also *Note _dos_open::, *Note _dos_creat::, *Note _dos_read::,
  7046. *Note _dos_write::, and *Note _dos_close::.
  7047.  
  7048. This function does not support long filenames, even on systems where the
  7049. LFN API (*note LFN: _use_lfn.) is available.  For LFN-aware functions
  7050. with similar functionality see *Note _creatnew::, and *Note _creat::.
  7051. Also see *Note creat::, and *Note open::, which are Posix-standard.
  7052.  
  7053. Return Value
  7054. ------------
  7055.  
  7056. Returns 0 if successful or DOS error code on error (and sets ERRNO).
  7057.  
  7058. Portability
  7059. -----------
  7060.  
  7061. not ANSI, not POSIX
  7062.  
  7063. Example
  7064. -------
  7065.  
  7066.      int handle;
  7067.      
  7068.      if ( !_dos_creatnew("FOO.DAT", _A_NORMAL, &handle) )
  7069.         puts("Creating was successful !");
  7070.  
  7071. 
  7072. File: libc.info,  Node: _dos_findfirst,  Next: _dos_findnext,  Prev: _dos_creatnew,  Up: Alphabetical List
  7073.  
  7074. _dos_findfirst
  7075. ==============
  7076.  
  7077. Syntax
  7078. ------
  7079.  
  7080.      #include <dos.h>
  7081.      
  7082.      unsigned int _dos_findfirst(char *name, unsigned int attr,
  7083.                                  struct find_t *result);
  7084.  
  7085. Description
  7086. -----------
  7087.  
  7088. This function and the related `_dos_findnext' (*note _dos_findnext::.)
  7089. are used to scan directories for the list of files therein. The NAME is
  7090. a wildcard that specifies the directory and files to search. RESULT is
  7091. a structure to hold the results and state of the search, and ATTR is a
  7092. combination of the following:
  7093.  
  7094. `_A_NORMAL (0x00)'
  7095.      Normal file (no read/write restrictions)
  7096.  
  7097. `_A_RDONLY (0x01)'
  7098.      Read only file
  7099.  
  7100. `_A_HIDDEN (0x02)'
  7101.      Hidden file
  7102.  
  7103. `_A_SYSTEM (0x04)'
  7104.      System file
  7105.  
  7106. `_A_VOLID (0x08)'
  7107.      Volume ID file
  7108.  
  7109. `_A_SUBDIR (0x10)'
  7110.      Subdirectory
  7111.  
  7112. `_A_ARCH (0x20)'
  7113.      Archive file
  7114.  
  7115. The results are returned in a `struct find_t' defined on `<dos.h>' as
  7116. follows:
  7117.  
  7118.      struct find_t {
  7119.        char reserved[21];
  7120.        unsigned char attrib;
  7121.        unsigned short wr_time;
  7122.        unsigned short wr_date;
  7123.        unsigned long size;
  7124.        char name[256];
  7125.      };
  7126.  
  7127. *Note _dos_findnext::.
  7128.  
  7129. This function does not support long filenames, even on systems where the
  7130. LFN API (*note LFN: _use_lfn.) is available.  For LFN-aware functions
  7131. with similar functionality see *Note findfirst::, and *Note findnext::.
  7132. Also see *Note opendir::, and *Note readdir::, which are Posix-standard.
  7133.  
  7134. Return Value
  7135. ------------
  7136.  
  7137. Zero if a match is found, DOS error code if not found (and sets ERRNO).
  7138.  
  7139. Portability
  7140. -----------
  7141.  
  7142. not ANSI, not POSIX
  7143.  
  7144. Example
  7145. -------
  7146.  
  7147.      #include <dos.h>
  7148.      
  7149.      struct find_t f;
  7150.      
  7151.      if ( !_dos_findfirst("*.DAT", &f, _A_ARCH | _A_RDONLY) )
  7152.      {
  7153.        do
  7154.        {
  7155.          printf("%-14s %10u %02u:%02u:%02u %02u/%02u/%04u\n",
  7156.                 f.name,
  7157.                 f.size,
  7158.                 (f.wr_time >> 11) & 0x1f,
  7159.                 (f.wr_time >>  5) & 0x3f,
  7160.                 (f.wr_time & 0x1f) * 2,
  7161.                 (f.wr_date >>  5) & 0x0f,
  7162.                 (f.wr_date & 0x1f),
  7163.                 ((f.wr_date >> 9) & 0x7f) + 1980);
  7164.        } while( !_dos_findnext(&f) );
  7165.      }
  7166.  
  7167. 
  7168. File: libc.info,  Node: _dos_findnext,  Next: _dos_getdate,  Prev: _dos_findfirst,  Up: Alphabetical List
  7169.  
  7170. _dos_findnext
  7171. =============
  7172.  
  7173. Syntax
  7174. ------
  7175.  
  7176.      #include <dos.h>
  7177.      
  7178.      unsigned int _dos_findnext(struct find_t *result);
  7179.  
  7180. Description
  7181. -----------
  7182.  
  7183. This finds the next file in the search started by `_dos_findfirst'.
  7184. See *Note _dos_findfirst::, for the description of `struct find_t'.
  7185.  
  7186. This function does not support long filenames, even on systems where the
  7187. LFN API (*note LFN: _use_lfn.) is available.  For LFN-aware functions
  7188. with similar functionality see *Note findfirst::, and *Note findnext::.
  7189. Also see *Note opendir::, and *Note readdir::, which are Posix-standard.
  7190.  
  7191. Return Value
  7192. ------------
  7193.  
  7194. Zero if a match is found, DOS error code if not found (and sets ERRNO).
  7195.  
  7196. Portability
  7197. -----------
  7198.  
  7199. not ANSI, not POSIX
  7200.  
  7201. 
  7202. File: libc.info,  Node: _dos_getdate,  Next: _dos_getdiskfree,  Prev: _dos_findnext,  Up: Alphabetical List
  7203.  
  7204. _dos_getdate
  7205. ============
  7206.  
  7207. Syntax
  7208. ------
  7209.  
  7210.      #include <dos.h>
  7211.      
  7212.      void _dos_getdate(struct dosdate_t *date);
  7213.  
  7214. Description
  7215. -----------
  7216.  
  7217. This function gets the current date and fills the DATE structure with
  7218. these values.
  7219.  
  7220.      struct dosdate_t {
  7221.        unsigned char  day;       /* 1-31          */
  7222.        unsigned char  month;     /* 1-12          */
  7223.        unsigned short year;      /* 1980-2099     */
  7224.        unsigned char  dayofweek; /* 0-6, 0=Sunday */
  7225.      };
  7226.  
  7227. *Note _dos_setdate::. *Note _dos_gettime::. *Note _dos_settime::.
  7228.  
  7229. Return Value
  7230. ------------
  7231.  
  7232. None.
  7233.  
  7234. Portability
  7235. -----------
  7236.  
  7237. not ANSI, not POSIX
  7238.  
  7239. Example
  7240. -------
  7241.  
  7242.      struct dosdate_t date;
  7243.      
  7244.      _dos_getdate(&date);
  7245.  
  7246. 
  7247. File: libc.info,  Node: _dos_getdiskfree,  Next: _dos_getdrive,  Prev: _dos_getdate,  Up: Alphabetical List
  7248.  
  7249. _dos_getdiskfree
  7250. ================
  7251.  
  7252. Syntax
  7253. ------
  7254.  
  7255.      #include <dos.h>
  7256.      
  7257.      unsigned int _dos_getdiskfree(unsigned int drive,
  7258.                                    struct diskfree_t *diskspace);
  7259.  
  7260. Description
  7261. -----------
  7262.  
  7263. This function determines the free space on DRIVE drive (0=default,
  7264. 1=A:, 2=B:, etc.) and fills DISKSPACE structure.  The members of
  7265. `struct diskfree_t' are defined by `<dos.h>' as follows:
  7266.  
  7267.      struct diskfree_t {
  7268.        unsigned short total_clusters;
  7269.        unsigned short avail_clusters;
  7270.        unsigned short sectors_per_cluster;
  7271.        unsigned short bytes_per_sector;
  7272.      };
  7273.  
  7274. Return Value
  7275. ------------
  7276.  
  7277. Returns with 0 if successful, non-zero on error (and sets `errno' to
  7278. `EINVAL').
  7279.  
  7280. Portability
  7281. -----------
  7282.  
  7283. not ANSI, not POSIX
  7284.  
  7285. Example
  7286. -------
  7287.  
  7288.      struct diskfree_t df;
  7289.      unsigned long freebytes;
  7290.      
  7291.      if ( !_dos_getdiskfree(0, &df) )
  7292.      {
  7293.        freebytes = (unsigned long)df.avail_clusters *
  7294.                    (unsigned long)df.bytes_per_sector *
  7295.                    (unsigned long)df.sectors_per_cluster;
  7296.        printf("There is %lu free bytes on the current drive.\n", freebytes);
  7297.      }
  7298.      else
  7299.        printf("Unable to get free disk space.\n");
  7300.  
  7301. 
  7302. File: libc.info,  Node: _dos_getdrive,  Next: _dos_getfileattr,  Prev: _dos_getdiskfree,  Up: Alphabetical List
  7303.  
  7304. _dos_getdrive
  7305. =============
  7306.  
  7307. Syntax
  7308. ------
  7309.  
  7310.      #include <dos.h>
  7311.      
  7312.      void _dos_getdrive(unsigned int *p_drive);
  7313.  
  7314. Description
  7315. -----------
  7316.  
  7317. This function determine the current default drive and writes this value
  7318. into P_DRIVE (1=A:, 2=B:, etc.).
  7319.  
  7320. *Note _dos_setdrive::.
  7321.  
  7322. Return Value
  7323. ------------
  7324.  
  7325. None.
  7326.  
  7327. Portability
  7328. -----------
  7329.  
  7330. not ANSI, not POSIX
  7331.  
  7332. Example
  7333. -------
  7334.  
  7335.      unsigned int drive;
  7336.      
  7337.      _dos_getdrive(&drive);
  7338.      printf("The current drive is %c:.\n", 'A' - 1 + drive);
  7339.  
  7340. 
  7341. File: libc.info,  Node: _dos_getfileattr,  Next: _dos_getftime,  Prev: _dos_getdrive,  Up: Alphabetical List
  7342.  
  7343. _dos_getfileattr
  7344. ================
  7345.  
  7346. Syntax
  7347. ------
  7348.  
  7349.      #include <dos.h>
  7350.      
  7351.      unsigned int _dos_getfileattr(const char *filename, unsigned int *p_attr);
  7352.  
  7353. Description
  7354. -----------
  7355.  
  7356. This function determines the attributes of given file and fills ATTR
  7357. with it. Use the following constans (in DOS.H) to check this value.
  7358.  
  7359. `_A_NORMAL (0x00)'
  7360.      Normal file (no read/write restrictions)
  7361.  
  7362. `_A_RDONLY (0x01)'
  7363.      Read only file
  7364.  
  7365. `_A_HIDDEN (0x02)'
  7366.      Hidden file
  7367.  
  7368. `_A_SYSTEM (0x04)'
  7369.      System file
  7370.  
  7371. `_A_VOLID (0x08)'
  7372.      Volume ID file
  7373.  
  7374. `_A_SUBDIR (0x10)'
  7375.      Subdirectory
  7376.  
  7377. `_A_ARCH (0x20)'
  7378.      Archive file
  7379.  
  7380. *Note _dos_setfileattr::.
  7381.  
  7382. This function does not support long filenames, even on systems where the
  7383. LFN API (*note LFN: _use_lfn.) is available.  For LFN-aware functions
  7384. with similar functionality see *Note _chmod::.  Also see *Note chmod::,
  7385. *Note access::, and *Note stat::, which are Posix-standard.
  7386.  
  7387. Return Value
  7388. ------------
  7389.  
  7390. Returns with 0 if successful and DOS error value on error (and sets
  7391. ERRNO=ENOENT).
  7392.  
  7393. Portability
  7394. -----------
  7395.  
  7396. not ANSI, not POSIX
  7397.  
  7398. Example
  7399. -------
  7400.  
  7401.      unsigned int attr;
  7402.      
  7403.      if ( !_dos_getfileattr("FOO.DAT", &attr) )
  7404.      {
  7405.        puts("FOO.DAT attributes are:");
  7406.        if ( attr & _A_ARCH )   puts("Archive");
  7407.        if ( attr & _A_RDONLY ) puts("Read only");
  7408.        if ( attr & _A_HIDDEN ) puts("Hidden");
  7409.        if ( attr & _A_SYSTEM ) puts("Is it part of DOS ?");
  7410.        if ( attr & _A_VOLID )  puts("Volume ID");
  7411.        if ( attr & _A_SUBDIR ) puts("Directory");
  7412.      }
  7413.      else
  7414.        puts("Unable to get FOO.DAT attributes.");
  7415.  
  7416. 
  7417. File: libc.info,  Node: _dos_getftime,  Next: _dos_gettime,  Prev: _dos_getfileattr,  Up: Alphabetical List
  7418.  
  7419. _dos_getftime
  7420. =============
  7421.  
  7422. Syntax
  7423. ------
  7424.  
  7425.      #include <dos.h>
  7426.      
  7427.      unsigned int _dos_getftime(int handle, unsigned int *p_date, unsigned *p_time);
  7428.  
  7429. Description
  7430. -----------
  7431.  
  7432. This function gets the date and time of the given file and puts these
  7433. values into P_DATE and P_TIME variable. The meaning of DOS date in the
  7434. P_DATE variable is the following:
  7435.  
  7436.      F   E   D   C   B   A   9   8   7   6   5   4   3   2   1   0  (bits)
  7437.      X   X   X   X   X   X   X   X   X   X   X   X   X   X   X   X
  7438.      *-----------------------*   *-----------*   *---------------*
  7439.              year                    month              day
  7440.      
  7441.      year  = 0-119 (relative to 1980)
  7442.      month = 1-12
  7443.      day   = 1-31
  7444.  
  7445. The meaning of DOS time in the P_TIME variable is the following:
  7446.  
  7447.      F   E   D   C   B   A   9   8   7   6   5   4   3   2   1   0
  7448.      X   X   X   X   X   X   X   X   X   X   X   X   X   X   X   X
  7449.      *---------------*   *-------------------*   *---------------*
  7450.            hours              minutes                seconds
  7451.      
  7452.      hours   = 0-23
  7453.      minutes = 0-59
  7454.      seconds = 0-29 in two-second intervals
  7455.  
  7456. *Note _dos_setftime::.
  7457.  
  7458. This function cannot be used to return last access and creation date and
  7459. time, even on systems where the LFN API (*note LFN: _use_lfn.) is
  7460. available.  See *Note _lfn_get_ftime::, for a function that can be used
  7461. to get the other two times.  Also see *Note fstat::, which is
  7462. Posix-standard.
  7463.  
  7464. Return Value
  7465. ------------
  7466.  
  7467. Returns 0 if successful and return DOS error on error (and sets
  7468. ERRNO=EBADF).
  7469.  
  7470. Portability
  7471. -----------
  7472.  
  7473. not ANSI, not POSIX
  7474.  
  7475. Example
  7476. -------
  7477.  
  7478.      unsigned int handle, date, time;
  7479.      
  7480.      _dos_open("FOO.DAT", O_RDWR, &handle);
  7481.      _dos_gettime(handle, &date, &time);
  7482.      _dos_close(handle);
  7483.      printf("FOO.DAT date and time is: %04u-%02u-%02u %02u:%02u:%02u.\n",
  7484.             /*       year                      month              day    */
  7485.             ((date >> 9) & 0x7F) + 1980U, (date >>  5) & 0x0F, date & 0x1F,
  7486.             /*       hour                minute           second         */
  7487.             (time >> 11) & 0x1F, (time >>  5) & 0x3F, (time & 0x1F) * 2);
  7488.  
  7489. 
  7490. File: libc.info,  Node: _dos_gettime,  Next: _dos_lock,  Prev: _dos_getftime,  Up: Alphabetical List
  7491.  
  7492. _dos_gettime
  7493. ============
  7494.  
  7495. Syntax
  7496. ------
  7497.  
  7498.      #include <dos.h>
  7499.      
  7500.      void _dos_gettime(struct dostime_t *time);
  7501.  
  7502. Description
  7503. -----------
  7504.  
  7505. This function gets the current time and fills the TIME structure with
  7506. these values.
  7507.  
  7508.      struct dostime_t {
  7509.        unsigned char hour;     /* 0-23 */
  7510.        unsigned char minute;   /* 0-59 */
  7511.        unsigned char second;   /* 0-59 */
  7512.        unsigned char hsecond;  /* 0-99 */
  7513.      };
  7514.  
  7515. *Note _dos_settime::. *Note _dos_getdate::. *Note _dos_setdate::.
  7516.  
  7517. Return Value
  7518. ------------
  7519.  
  7520. None.
  7521.  
  7522. Portability
  7523. -----------
  7524.  
  7525. not ANSI, not POSIX
  7526.  
  7527. Example
  7528. -------
  7529.  
  7530.      struct dostime_t time;
  7531.      
  7532.      _dos_gettime(&time);
  7533.  
  7534. 
  7535. File: libc.info,  Node: _dos_lock,  Next: _dos_open,  Prev: _dos_gettime,  Up: Alphabetical List
  7536.  
  7537. _dos_lock
  7538. =========
  7539.  
  7540. Syntax
  7541. ------
  7542.  
  7543.      #include <io.h>
  7544.      
  7545.      int _dos_lock(int _fd, long _offset, long _length)
  7546.  
  7547. Description
  7548. -----------
  7549.  
  7550. Adds an advisory lock to the specified region of the file.
  7551.  
  7552. Return Value
  7553. ------------
  7554.  
  7555. Zero if the lock was added, nonzero otherwise.
  7556.  
  7557. Portability
  7558. -----------
  7559.  
  7560. not ANSI, not POSIX
  7561.  
  7562. 
  7563. File: libc.info,  Node: _dos_open,  Next: _dos_read,  Prev: _dos_lock,  Up: Alphabetical List
  7564.  
  7565. _dos_open
  7566. =========
  7567.  
  7568. Syntax
  7569. ------
  7570.  
  7571.      #include <fcntl.h>
  7572.      #include <share.h>
  7573.      #include <dos.h>
  7574.      
  7575.      unsigned int _dos_open(const char *filename, unsigned short mode, int *handle);
  7576.  
  7577. Description
  7578. -----------
  7579.  
  7580. This is a direct connection to the MS-DOS open function call (%ah =
  7581. 0x3D).  This function opens the given file with the given mode and puts
  7582. handle of file into HANDLE if openning is successful.  Meaning of MODE
  7583. parameter is the following:
  7584.  
  7585. Access mode bits (in FCNTL.H):
  7586. `O_RDONLY (_O_RDONLY) 0x00'
  7587.      Open for read only
  7588.  
  7589. `O_WRONLY (_O_WRONLY) 0x01'
  7590.      Open for write only
  7591.  
  7592. `O_RDWR (_O_RDWR) 0x02'
  7593.      Open for read and write
  7594.  
  7595. Sharing mode bits (in SHARE.H):
  7596. `SH_COMPAT (_SH_COMPAT) 0x00'
  7597.      Compatibility mode
  7598.  
  7599. `SH_DENYRW (_SH_DENYRW) 0x10'
  7600.      Deny read/write mode
  7601.  
  7602. `SH_DENYWR (_SH_DENYWR) 0x20'
  7603.      Deny write mode
  7604.  
  7605. `SH_DENYRD (_SH_DENYRD) 0x30'
  7606.      Deny read mode
  7607.  
  7608. `SH_DENYNO (_SH_DENYNO) 0x40'
  7609.      Deny none mode
  7610.  
  7611. Inheritance bits (in FCNTL.H):
  7612. `O_NOINHERIT (_O_NOINHERIT) 0x80'
  7613.      File is not inherited by child process
  7614.  
  7615. See also *Note _dos_creat::, *Note _dos_creatnew::, *Note _dos_read::,
  7616. *Note _dos_write::, and *Note _dos_close::.
  7617.  
  7618. This function does not support long filenames, even on systems where the
  7619. LFN API (*note LFN: _use_lfn.) is available.  For LFN-aware functions
  7620. with similar functionality see *Note _open::, *Note _creat::, and *Note
  7621. _creatnew::.  Also see *Note open::, and *Note creat::, which are
  7622. Posix-standard.
  7623.  
  7624. Return Value
  7625. ------------
  7626.  
  7627. Returns 0 if successful or DOS error code on error (and sets ERRNO to
  7628. EACCES, EINVAL, EMFILE or ENOENT).
  7629.  
  7630. Portability
  7631. -----------
  7632.  
  7633. not ANSI, not POSIX
  7634.  
  7635. Example
  7636. -------
  7637.  
  7638.      int handle;
  7639.      
  7640.      if ( !_dos_open("FOO.DAT", O_RDWR, &handle) )
  7641.         puts("Wow, file opening was successful !");
  7642.  
  7643. 
  7644. File: libc.info,  Node: _dos_read,  Next: _dos_setdate,  Prev: _dos_open,  Up: Alphabetical List
  7645.  
  7646. _dos_read
  7647. =========
  7648.  
  7649. Syntax
  7650. ------
  7651.  
  7652.      #include <dos.h>
  7653.      
  7654.      unsigned int _dos_read(int handle, void *buffer, unsigned int count, unsigned int *result);
  7655.  
  7656. Description
  7657. -----------
  7658.  
  7659. This is a direct connection to the MS-DOS read function call (%ah =
  7660. 0x3F).  No conversion is done on the data; it is read as raw binary
  7661. data.  This function reads from HANDLE into BUFFER COUNT bytes.  COUNT
  7662. value may be arbitrary size (for example > 64KB).  It puts number of
  7663. bytes read into RESULT if reading is successful.
  7664.  
  7665. See also *Note _dos_open::, *Note _dos_creat::, *Note _dos_creatnew::,
  7666. *Note _dos_write::, and *Note _dos_close::.
  7667.  
  7668. Return Value
  7669. ------------
  7670.  
  7671. Returns 0 if successful or DOS error code on error (and sets ERRNO to
  7672. EACCES or EBADF)
  7673.  
  7674. Portability
  7675. -----------
  7676.  
  7677. not ANSI, not POSIX
  7678.  
  7679. Example
  7680. -------
  7681.  
  7682.      int handle;
  7683.      unsigned int result;
  7684.      char *filebuffer;
  7685.      
  7686.      if ( !_dos_open("FOO.DAT", O_RDONLY, &handle) )
  7687.      {
  7688.         puts("FOO.DAT openning was successful.");
  7689.         if ( (filebuffer = malloc(130000)) != NULL )
  7690.         {
  7691.           if ( !_dos_read(handle, buffer, 130000, &result) )
  7692.             printf("%u bytes read from FOO.DAT.\n", result);
  7693.           else
  7694.             puts("Reading error.");
  7695.           ...
  7696.           /* Do something with filebuffer. */
  7697.           ...
  7698.         }
  7699.         _dos_close(handle);
  7700.      }
  7701.  
  7702. 
  7703. File: libc.info,  Node: _dos_setdate,  Next: _dos_setdrive,  Prev: _dos_read,  Up: Alphabetical List
  7704.  
  7705. _dos_setdate
  7706. ============
  7707.  
  7708. Syntax
  7709. ------
  7710.  
  7711.      #include <dos.h>
  7712.      
  7713.      unsigned int _dos_setdate(struct dosdate_t *date);
  7714.  
  7715. Description
  7716. -----------
  7717.  
  7718. This function sets the current date. The DOSDATE_T structure is as
  7719. follows:
  7720.  
  7721.      struct dosdate_t {
  7722.        unsigned char  day;       /* 1-31          */
  7723.        unsigned char  month;     /* 1-12          */
  7724.        unsigned short year;      /* 1980-2099     */
  7725.        unsigned char  dayofweek; /* 0-6, 0=Sunday */
  7726.      };
  7727.  
  7728. DAYOFWEEK field has no effect at this function call.
  7729.  
  7730. *Note _dos_getdate::. *Note _dos_gettime::. *Note _dos_settime::.
  7731.  
  7732. Return Value
  7733. ------------
  7734.  
  7735. Returns 0 if successful and non-zero on error (and sets ERRNO=EINVAL).
  7736.  
  7737. Portability
  7738. -----------
  7739.  
  7740. not ANSI, not POSIX
  7741.  
  7742. Example
  7743. -------
  7744.  
  7745.      struct dosdate_t date;
  7746.      
  7747.      date->year  = 1999;
  7748.      date->month = 12;
  7749.      date->day   = 31;
  7750.      if ( !_dos_setdate(&date) )
  7751.        puts("It was a valid date.");
  7752.  
  7753. 
  7754. File: libc.info,  Node: _dos_setdrive,  Next: _dos_setfileattr,  Prev: _dos_setdate,  Up: Alphabetical List
  7755.  
  7756. _dos_setdrive
  7757. =============
  7758.  
  7759. Syntax
  7760. ------
  7761.  
  7762.      #include <dos.h>
  7763.      
  7764.      void _dos_setdrive(unsigned int drive, unsigned int *p_drives);
  7765.  
  7766. Description
  7767. -----------
  7768.  
  7769. This function set the current default drive based on DRIVE (1=A:, 2=B:,
  7770. etc.) and determines the number of available logical drives and fills
  7771. P_DRIVES with it.
  7772.  
  7773. *Note _dos_getdrive::.
  7774.  
  7775. Return Value
  7776. ------------
  7777.  
  7778. None.
  7779.  
  7780. Portability
  7781. -----------
  7782.  
  7783. not ANSI, not POSIX
  7784.  
  7785. Example
  7786. -------
  7787.  
  7788.      unsigned int available_drives;
  7789.      
  7790.      /* The current drive will be A: */
  7791.      _dos_setdrive(1, &available_drives);
  7792.      printf("Number of available logical drives %u.\n", available_drives);
  7793.  
  7794. 
  7795. File: libc.info,  Node: _dos_setfileattr,  Next: _dos_setftime,  Prev: _dos_setdrive,  Up: Alphabetical List
  7796.  
  7797. _dos_setfileattr
  7798. ================
  7799.  
  7800. Syntax
  7801. ------
  7802.  
  7803.      #include <dos.h>
  7804.      
  7805.      unsigned int _dos_setfileattr(const char *filename, unsigned int attr);
  7806.  
  7807. Description
  7808. -----------
  7809.  
  7810. This function sets the attributes of given file. Use the following
  7811. constans in DOS.H to create ATTR parameter:
  7812.  
  7813. `_A_NORMAL (0x00)'
  7814.      Normal file (no read/write restrictions)
  7815.  
  7816. `_A_RDONLY (0x01)'
  7817.      Read only file
  7818.  
  7819. `_A_HIDDEN (0x02)'
  7820.      Hidden file
  7821.  
  7822. `_A_SYSTEM (0x04)'
  7823.      System file
  7824.  
  7825. `_A_VOLID (0x08)'
  7826.      Volume ID file
  7827.  
  7828. `_A_SUBDIR (0x10)'
  7829.      Subdirectory
  7830.  
  7831. `_A_ARCH (0x20)'
  7832.      Archive file
  7833.  
  7834. *Note _dos_getfileattr::.
  7835.  
  7836. This function does not support long filenames, even on systems where the
  7837. LFN API (*note LFN: _use_lfn.) is available.  For LFN-aware functions
  7838. with similar functionality see *Note _chmod::.  Also see *Note chmod::,
  7839. which is Posix-standard.
  7840.  
  7841. Return Value
  7842. ------------
  7843.  
  7844. Returns with 0 if successful and DOS error value on error (and sets
  7845. ERRNO to ENOENT or EACCES).
  7846.  
  7847. Portability
  7848. -----------
  7849.  
  7850. not ANSI, not POSIX
  7851.  
  7852. Example
  7853. -------
  7854.  
  7855.      if ( !_dos_setfileattr("FOO.DAT", _A_RDONLY | _A_HIDDEN) )
  7856.         puts("FOO.DAT is hidden now.");
  7857.  
  7858. 
  7859. File: libc.info,  Node: _dos_setftime,  Next: _dos_settime,  Prev: _dos_setfileattr,  Up: Alphabetical List
  7860.  
  7861. _dos_setftime
  7862. =============
  7863.  
  7864. Syntax
  7865. ------
  7866.  
  7867.      #include <dos.h>
  7868.      
  7869.      unsigned int _dos_setftime(int handle, unsigned int date, unsigned time);
  7870.  
  7871. Description
  7872. -----------
  7873.  
  7874. This function sets the date and time of the given file. The meaning of
  7875. DOS date in the DATE variable is the following:
  7876.  
  7877.      F E D C B A 9 8 7 6 5 4 3 2 1 0 (bits)
  7878.      x x x x x x x x x x x x x x x x
  7879.      *-----------* *-----* *-------*
  7880.          year       month     day
  7881.      
  7882.      year  = 0-119 (relative to 1980)
  7883.      month = 1-12
  7884.      day   = 1-31
  7885.  
  7886. The meaning of DOS time in the TIME variable is the following:
  7887.  
  7888.      F E D C B A 9 8 7 6 5 4 3 2 1 0 (bits)
  7889.      x x x x x x x x x x x x x x x x
  7890.      *-------* *---------* *-------*
  7891.        hours     minutes    seconds
  7892.      
  7893.      hours   = 0-23
  7894.      minutes = 0-59
  7895.      seconds = 0-29 in two-second intervals
  7896.  
  7897. *Note _dos_getftime::.
  7898.  
  7899. This function cannot be used to set the last access date and time, even
  7900. on systems where the LFN API (*note LFN: _use_lfn.) is available.  For
  7901. LFN-aware functions with similar functionality see *Note utime::, which
  7902. is Posix-standard, and see *Note utimes::.
  7903.  
  7904. Return Value
  7905. ------------
  7906.  
  7907. Returns 0 if successful and return DOS error on error (and sets
  7908. ERRNO=EBADF).
  7909.  
  7910. Portability
  7911. -----------
  7912.  
  7913. not ANSI, not POSIX
  7914.  
  7915. Example
  7916. -------
  7917.  
  7918.      struct dosdate_t d;
  7919.      struct dostime_t t;
  7920.      unsigned int handle, date, time;
  7921.      
  7922.      _dos_open("FOO.DAT", O_RDWR, &handle);
  7923.      _dos_getdate(&d);
  7924.      _dos_gettime(&t);
  7925.      date = ((d.year - 1980) << 9) | (d.month << 5) | d.day;
  7926.      time = (t.hour << 11) | (t.minute << 5) | (t.second / 2);
  7927.      _dos_settime(handle, date, time);
  7928.      _dos_close(handle);
  7929.  
  7930. 
  7931. File: libc.info,  Node: _dos_settime,  Next: _dos_unlock,  Prev: _dos_setftime,  Up: Alphabetical List
  7932.  
  7933. _dos_settime
  7934. ============
  7935.  
  7936. Syntax
  7937. ------
  7938.  
  7939.      #include <dos.h>
  7940.      
  7941.      void _dos_settime(struct dostime_t *time);
  7942.  
  7943. Description
  7944. -----------
  7945.  
  7946. This function sets the current time. The TIME structure is as follows:
  7947.  
  7948.      struct dostime_t {
  7949.        unsigned char hour;     /* 0-23 */
  7950.        unsigned char minute;   /* 0-59 */
  7951.        unsigned char second;   /* 0-59 */
  7952.        unsigned char hsecond;  /* 0-99 */
  7953.      };
  7954.  
  7955. *Note _dos_gettime::. *Note _dos_getdate::. *Note _dos_setdate::.
  7956.  
  7957. Return Value
  7958. ------------
  7959.  
  7960. Returns 0 if successful and non-zero on error (and sets ERRNO=EINVAL).
  7961.  
  7962. Portability
  7963. -----------
  7964.  
  7965. not ANSI, not POSIX
  7966.  
  7967. Example
  7968. -------
  7969.  
  7970.      struct dostime_t time;
  7971.      
  7972.      time->hour    = 23;
  7973.      time->minute  = 59;
  7974.      time->second  = 59;
  7975.      time->hsecond = 99;
  7976.      if ( !_dos_settime(&time) )
  7977.        puts("It was a valid time.");
  7978.  
  7979. 
  7980. File: libc.info,  Node: _dos_unlock,  Next: _dos_write,  Prev: _dos_settime,  Up: Alphabetical List
  7981.  
  7982. _dos_unlock
  7983. ===========
  7984.  
  7985. Syntax
  7986. ------
  7987.  
  7988.      #include <io.h>
  7989.      
  7990.      _dos_unlock(int _fd, long _offset, long _length)
  7991.  
  7992. Description
  7993. -----------
  7994.  
  7995. Removes an advisory lock to the specified region of the file.
  7996.  
  7997. Return Value
  7998. ------------
  7999.  
  8000. Zero if the lock was removed, nonzero otherwise.
  8001.  
  8002. Portability
  8003. -----------
  8004.  
  8005. not ANSI, not POSIX
  8006.  
  8007. 
  8008. File: libc.info,  Node: _dos_write,  Next: _doscan,  Prev: _dos_unlock,  Up: Alphabetical List
  8009.  
  8010. _dos_write
  8011. ==========
  8012.  
  8013. Syntax
  8014. ------
  8015.  
  8016.      #include <dos.h>
  8017.      
  8018.      unsigned int _dos_write(int handle, const void *buffer, unsigned int count,
  8019.                              unsigned int *result);
  8020.  
  8021. Description
  8022. -----------
  8023.  
  8024. This is a direct connection to the MS-DOS write function call (%ah =
  8025. 0x40).  No conversion is done on the data; it is written as raw binary
  8026. data.  This function writes COUNT bytes from BUFFER to HANDLE.  COUNT
  8027. value may be arbitrary size (e.g. > 64KB).  It puts the number of bytes
  8028. written into RESULT if writing is successful.
  8029.  
  8030. See also *Note _dos_open::, *Note _dos_creat::, *Note _dos_creatnew::,
  8031. *Note _dos_read::, and *Note _dos_close::.
  8032.  
  8033. Return Value
  8034. ------------
  8035.  
  8036. Returns 0 if successful or DOS error code on error (and sets ERRNO to
  8037. EACCES or EBADF)
  8038.  
  8039. Portability
  8040. -----------
  8041.  
  8042. not ANSI, not POSIX
  8043.  
  8044. Example
  8045. -------
  8046.  
  8047.      int handle;
  8048.      unsigned int result;
  8049.      char *filebuffer;
  8050.      
  8051.      if ( !_dos_creat("FOO.DAT", _A_ARCH, &handle) )
  8052.      {
  8053.         puts("FOO.DAT creating was successful.");
  8054.         if ( (filebuffer = malloc(130000)) != NULL )
  8055.         {
  8056.           ...
  8057.           /* Put something into filebuffer. */
  8058.           ...
  8059.           if ( !_dos_write(handle, buffer, 130000, &result) )
  8060.             printf("%u bytes written into FOO.DAT.", result);
  8061.           else
  8062.             puts("Writing error.");
  8063.         }
  8064.         _dos_close(handle);
  8065.      }
  8066.  
  8067. 
  8068. File: libc.info,  Node: _doscan,  Next: _doserrno,  Prev: _dos_write,  Up: Alphabetical List
  8069.  
  8070. _doscan
  8071. =======
  8072.  
  8073. Syntax
  8074. ------
  8075.  
  8076.      #include <stdio.h>
  8077.      
  8078.      int _doscan(FILE *file, const char *format, void **ptrs_to_args);
  8079.  
  8080. Description
  8081. -----------
  8082.  
  8083. This is an internal function that is used by all the `scanf' style
  8084. functions, which simply pass their format, arguments, and stream to this
  8085. function.
  8086.  
  8087. *Note scanf::, for a discussion of the allowed formats and arguments.
  8088.  
  8089. Return Value
  8090. ------------
  8091.  
  8092. The number of characters successfully scanned is returned, or -1 on
  8093. error.
  8094.  
  8095. Portability
  8096. -----------
  8097.  
  8098. not ANSI, not POSIX
  8099.  
  8100. Example
  8101. -------
  8102.  
  8103.      int x, y;
  8104.      int *args[2];
  8105.      args[0] = &x;
  8106.      args[1] = &y;
  8107.      _doscan(stdin, "%d %d", args);
  8108.  
  8109. 
  8110. File: libc.info,  Node: _doserrno,  Next: dosexterr,  Prev: _doscan,  Up: Alphabetical List
  8111.  
  8112. _doserrno
  8113. =========
  8114.  
  8115. Syntax
  8116. ------
  8117.  
  8118.      #include <errno.h>
  8119.      
  8120.      extern int _doserrno;
  8121.  
  8122. Description
  8123. -----------
  8124.  
  8125. Whenever a DOS call returns a failure indication, this variable is
  8126. assigned the value of the error code returned by the failed DOS call.
  8127.  
  8128. For a list of the error codes and their short descriptions, see *Note
  8129. dosexterr::.
  8130.  
  8131. Portability
  8132. -----------
  8133.  
  8134. not ANSI, not POSIX
  8135.  
  8136. Example
  8137. -------
  8138.  
  8139.       _doserrno = 0;
  8140.       fprintf (stdprn, "Hello, world!\r\n\f");
  8141.       if (_doserrno == 0x1c)
  8142.         fprintf (stderr, "The printer is out of paper!\n");
  8143.  
  8144. 
  8145. File: libc.info,  Node: dosexterr,  Next: dosmemget,  Prev: _doserrno,  Up: Alphabetical List
  8146.  
  8147. dosexterr
  8148. =========
  8149.  
  8150. Syntax
  8151. ------
  8152.  
  8153.      #include <dos.h>
  8154.      
  8155.      int dosexterr(struct DOSERROR *p_error);
  8156.  
  8157. Description
  8158. -----------
  8159.  
  8160. This function reads extended error information from DOS and fills
  8161. P_ERROR structure.
  8162.  
  8163.      struct _DOSERROR {
  8164.        int  exterror;
  8165.        char class;
  8166.        char action;
  8167.        char locus;
  8168.      };
  8169.  
  8170. Values for extended error code (EXTERROR field):
  8171.      00h (0)   no error
  8172.      01h (1)   function number invalid
  8173.      02h (2)   file not found
  8174.      03h (3)   path not found
  8175.      04h (4)   too many open files (no handles available)
  8176.      05h (5)   access denied
  8177.      06h (6)   invalid handle
  8178.      07h (7)   memory control block destroyed
  8179.      08h (8)   insufficient memory
  8180.      09h (9)   memory block address invalid
  8181.      0Ah (10)  environment invalid (usually >32K in length)
  8182.      0Bh (11)  format invalid
  8183.      0Ch (12)  access code invalid
  8184.      0Dh (13)  data invalid
  8185.      0Eh (14)  reserved
  8186.      0Fh (15)  invalid drive
  8187.      10h (16)  attempted to remove current directory
  8188.      11h (17)  not same device
  8189.      12h (18)  no more files
  8190.      13h (19)  disk write-protected
  8191.      14h (20)  unknown unit
  8192.      15h (21)  drive not ready
  8193.      16h (22)  unknown command
  8194.      17h (23)  data error (CRC)
  8195.      18h (24)  bad request structure length
  8196.      19h (25)  seek error
  8197.      1Ah (26)  unknown media type (non-DOS disk)
  8198.      1Bh (27)  sector not found
  8199.      1Ch (28)  printer out of paper
  8200.      1Dh (29)  write fault
  8201.      1Eh (30)  read fault
  8202.      1Fh (31)  general failure
  8203.      20h (32)  sharing violation
  8204.      21h (33)  lock violation
  8205.      22h (34)  disk change invalid (ES:DI -> media ID structure)(see below)
  8206.      23h (35)  FCB unavailable
  8207.      24h (36)  sharing buffer overflow
  8208.      25h (37)  (DOS 4+) code page mismatch
  8209.      26h (38)  (DOS 4+) cannot complete file operation (out of input)
  8210.      27h (39)  (DOS 4+) insufficient disk space
  8211.      28h-31h   reserved
  8212.      32h (50)  network request not supported
  8213.      33h (51)  remote computer not listening
  8214.      34h (52)  duplicate name on network
  8215.      35h (53)  network name not found
  8216.      36h (54)  network busy
  8217.      37h (55)  network device no longer exists
  8218.      38h (56)  network BIOS command limit exceeded
  8219.      39h (57)  network adapter hardware error
  8220.      3Ah (58)  incorrect response from network
  8221.      3Bh (59)  unexpected network error
  8222.      3Ch (60)  incompatible remote adapter
  8223.      3Dh (61)  print queue full
  8224.      3Eh (62)  queue not full
  8225.      3Fh (63)  not enough space to print file
  8226.      40h (64)  network name was deleted
  8227.      41h (65)  network: Access denied
  8228.      42h (66)  network device type incorrect
  8229.      43h (67)  network name not found
  8230.      44h (68)  network name limit exceeded
  8231.      45h (69)  network BIOS session limit exceeded
  8232.      46h (70)  temporarily paused
  8233.      47h (71)  network request not accepted
  8234.      48h (72)  network print/disk redirection paused
  8235.      49h (73)  network software not installed
  8236.                (LANtastic) invalid network version
  8237.      4Ah (74)  unexpected adapter close
  8238.                (LANtastic) account expired
  8239.      4Bh (75)  (LANtastic) password expired
  8240.      4Ch (76)  (LANtastic) login attempt invalid at this time
  8241.      4Dh (77)  (LANtastic v3+) disk limit exceeded on network node
  8242.      4Eh (78)  (LANtastic v3+) not logged in to network node
  8243.      4Fh (79)  reserved
  8244.      50h (80)  file exists
  8245.      51h (81)  reserved
  8246.      52h (82)  cannot make directory
  8247.      53h (83)  fail on INT 24h
  8248.      54h (84)  (DOS 3.3+) too many redirections
  8249.      55h (85)  (DOS 3.3+) duplicate redirection
  8250.      56h (86)  (DOS 3.3+) invalid password
  8251.      57h (87)  (DOS 3.3+) invalid parameter
  8252.      58h (88)  (DOS 3.3+) network write fault
  8253.      59h (89)  (DOS 4+) function not supported on network
  8254.      5Ah (90)  (DOS 4+) required system component not installed
  8255.      64h (100) (MSCDEX) unknown error
  8256.      65h (101) (MSCDEX) not ready
  8257.      66h (102) (MSCDEX) EMS memory no longer valid
  8258.      67h (103) (MSCDEX) not High Sierra or ISO-9660 format
  8259.      68h (104) (MSCDEX) door open
  8260.  
  8261. Values for error class (CLASS field):
  8262.      01h  out of resource (storage space or I/O channels)
  8263.      02h  temporary situation (file or record lock)
  8264.      03h  authorization (denied access)
  8265.      04h  internal (system software bug)
  8266.      05h  hardware failure
  8267.      06h  system failure (configuration file missing or incorrect)
  8268.      07h  application program error
  8269.      08h  not found
  8270.      09h  bad format
  8271.      0Ah  locked
  8272.      0Bh  media error
  8273.      0Ch  already exists
  8274.      0Dh  unknown
  8275.  
  8276. Values for suggested action (ACTION field):
  8277.      01h  retry
  8278.      02h  delayed retry
  8279.      03h  prompt user to reenter input
  8280.      04h  abort after cleanup
  8281.      05h  immediate abort
  8282.      06h  ignore
  8283.      07h  retry after user intervention
  8284.  
  8285. Values for error locus (LOCUS field):
  8286.      01h  unknown or not appropriate
  8287.      02h  block device (disk error)
  8288.      03h  network related
  8289.      04h  serial device (timeout)
  8290.      05h  memory related
  8291.  
  8292. Return Value
  8293. ------------
  8294.  
  8295. Returns with the extended error code.
  8296.  
  8297. Portability
  8298. -----------
  8299.  
  8300. not ANSI, not POSIX
  8301.  
  8302. Example
  8303. -------
  8304.  
  8305.      #include <stdio.h>
  8306.      #include <dos.h>
  8307.      
  8308.      void main(void)
  8309.      {
  8310.        FILE *fp;
  8311.        struct _DOSERROR de;
  8312.      
  8313.        fp = fopen("EXAMPLE.DAT","r");
  8314.        if ( fp == NULL )
  8315.        {
  8316.          puts("Unable to open file for reading.");
  8317.          _dosexterr(&de);
  8318.          printf("Extended DOS error information:\n");
  8319.          printf("Extended error: %i\n",de.exterror);
  8320.          printf("Class:          %x\n",de.class);
  8321.          printf("Action:         %x\n",de.action);
  8322.          printf("Error Locus:    %x\n",de.locus);
  8323.        }
  8324.      }
  8325.  
  8326. 
  8327. File: libc.info,  Node: dosmemget,  Next: dosmemgetb,  Prev: dosexterr,  Up: Alphabetical List
  8328.  
  8329. dosmemget
  8330. =========
  8331.  
  8332. Syntax
  8333. ------
  8334.  
  8335.      #include <sys/movedata.h>
  8336.      
  8337.      void dosmemget(int offset, int length, void *buffer);
  8338.  
  8339. Description
  8340. -----------
  8341.  
  8342. This function transfers data from MS-DOS's conventional memory space to
  8343. the program's virtual address space.  The OFFSET is a physical address,
  8344. which can be computed from a real-mode segment/offset pair as follows:
  8345.  
  8346.      offset = segment * 16 + offset;
  8347.  
  8348. The LENGTH is the number of bytes to transfer, and BUFFER is a pointer
  8349. to somewhere in your virtual address space (such as memory obtained
  8350. from `malloc') where the data will go.
  8351.  
  8352. Return Value
  8353. ------------
  8354.  
  8355. None.
  8356.  
  8357. Portability
  8358. -----------
  8359.  
  8360. not ANSI, not POSIX
  8361.  
  8362. Example
  8363. -------
  8364.  
  8365.      unsigned short shift_state;
  8366.      dosmemget(0x417, 2, &shift_state);
  8367.      if (shift_state & 0x0004)
  8368.        /* Ctrl key pressed */;
  8369.  
  8370. 
  8371. File: libc.info,  Node: dosmemgetb,  Next: dosmemgetl,  Prev: dosmemget,  Up: Alphabetical List
  8372.  
  8373. dosmemgetb
  8374. ==========
  8375.  
  8376. Syntax
  8377. ------
  8378.  
  8379.      #include <sys/movedata.h>
  8380.      
  8381.      void _dosmemgetb(unsigned long offset, size_t xfers, void *buffer);
  8382.  
  8383. Description
  8384. -----------
  8385.  
  8386. This function transfers data from MS-DOS's conventional memory space to
  8387. the program's virtual address space, using only byte transfers.  The
  8388. OFFSET is a physical address, which can be computed from a real-mode
  8389. segment/offset pair as follows:
  8390.  
  8391.      offset = segment * 16 + offset;
  8392.  
  8393. The XFERS is the number of bytes to transfer, and BUFFER is a pointer
  8394. to somewhere in your virtual address space (such as memory obtained
  8395. from `malloc') where the data will go.
  8396.  
  8397. Return Value
  8398. ------------
  8399.  
  8400. None.
  8401.  
  8402. Portability
  8403. -----------
  8404.  
  8405. not ANSI, not POSIX
  8406.  
  8407. Example
  8408. -------
  8409.  
  8410.      unsigned short shift_state;
  8411.      _dosmemgetb(0x417, 2, &shift_state);
  8412.      if (shift_state & 0x0004)
  8413.        /* Ctrl key pressed */;
  8414.  
  8415. 
  8416. File: libc.info,  Node: dosmemgetl,  Next: dosmemgetw,  Prev: dosmemgetb,  Up: Alphabetical List
  8417.  
  8418. dosmemgetl
  8419. ==========
  8420.  
  8421. Syntax
  8422. ------
  8423.  
  8424.      #include <sys/movedata.h>
  8425.      
  8426.      void _dosmemgetl(unsigned long offset, size_t xfers, void *buffer);
  8427.  
  8428. Description
  8429. -----------
  8430.  
  8431. This function transfers data from MS-DOS's conventional memory space to
  8432. the program's virtual address space, using only long-word (32-bit)
  8433. transfers.  The OFFSET is a physical address, which can be computed
  8434. from a real-mode segment/offset pair as follows:
  8435.  
  8436.      offset = segment * 16 + offset;
  8437.  
  8438. The COUNT is the number of long-words to transfer, and BUFFER is a
  8439. pointer to somewhere in your virtual address space (such as memory
  8440. obtained from `malloc') where the data will go.
  8441.  
  8442. Return Value
  8443. ------------
  8444.  
  8445. None.
  8446.  
  8447. Portability
  8448. -----------
  8449.  
  8450. not ANSI, not POSIX
  8451.  
  8452. Example
  8453. -------
  8454.  
  8455.      unsigned long shift_state;
  8456.      _dosmemgetl(0x417, 1, &shift_state);
  8457.      if (shift_state & 0x0004)
  8458.        /* Ctrl key pressed */;
  8459.  
  8460. 
  8461. File: libc.info,  Node: dosmemgetw,  Next: dosmemput,  Prev: dosmemgetl,  Up: Alphabetical List
  8462.  
  8463. dosmemgetw
  8464. ==========
  8465.  
  8466. Syntax
  8467. ------
  8468.  
  8469.      #include <sys/movedata.h>
  8470.      
  8471.      void _dosmemgetw(unsigned long offset, size_t xfers, void *buffer);
  8472.  
  8473. Description
  8474. -----------
  8475.  
  8476. This function transfers data from MS-DOS's conventional memory space to
  8477. the program's virtual address space, using only short-word (16-bit)
  8478. transfers.  The OFFSET is a physical address, which can be computed
  8479. from a real-mode segment/offset pair as follows:
  8480.  
  8481.      offset = segment * 16 + offset;
  8482.  
  8483. The XFERS is the number of words to transfer, and BUFFER is a pointer
  8484. to somewhere in your virtual address space (such as memory obtained
  8485. from `malloc') where the data will go.
  8486.  
  8487. Return Value
  8488. ------------
  8489.  
  8490. None.
  8491.  
  8492. Portability
  8493. -----------
  8494.  
  8495. not ANSI, not POSIX
  8496.  
  8497. Example
  8498. -------
  8499.  
  8500.      unsigned short shift_state;
  8501.      _dosmemgetw(0x417, 1, &shift_state);
  8502.      if (shift_state & 0x0004)
  8503.        /* Ctrl key pressed */;
  8504.  
  8505. 
  8506. File: libc.info,  Node: dosmemput,  Next: dosmemputb,  Prev: dosmemgetw,  Up: Alphabetical List
  8507.  
  8508. dosmemput
  8509. =========
  8510.  
  8511. Syntax
  8512. ------
  8513.  
  8514.      #include <sys/movedata.h>
  8515.      
  8516.      void dosmemput(const void *buffer, int length, int offset);
  8517.  
  8518. Description
  8519. -----------
  8520.  
  8521. This function transfers data from the program's virtual address space to
  8522. MS-DOS's conventional memory space.  The OFFSET is a physical address,
  8523. which can be computed from a real-mode segment/offset pair as follows:
  8524.  
  8525.      offset = segment * 16 + offset;
  8526.  
  8527. The LENGTH is the number of bytes to transfer, and BUFFER is a pointer
  8528. to somewhere in your virtual address space (such as memory obtained
  8529. from `malloc') where the data will come from.
  8530.  
  8531. Return Value
  8532. ------------
  8533.  
  8534. None.
  8535.  
  8536. Portability
  8537. -----------
  8538.  
  8539. not ANSI, not POSIX
  8540.  
  8541. Example
  8542. -------
  8543.  
  8544.      unsigned short save_screen[25][80];
  8545.      dosmemput(save_screen, 80*2*25, 0xb8000);
  8546.  
  8547. 
  8548. File: libc.info,  Node: dosmemputb,  Next: dosmemputl,  Prev: dosmemput,  Up: Alphabetical List
  8549.  
  8550. dosmemputb
  8551. ==========
  8552.  
  8553. Syntax
  8554. ------
  8555.  
  8556.      #include <sys/movedata.h>
  8557.      
  8558.      void _dosmemputb(const void *buffer, size_t xfers, unsigned long offset);
  8559.  
  8560. Description
  8561. -----------
  8562.  
  8563. This function transfers data from the program's virtual address space
  8564. to MS-DOS's conventional memory space, using only byte (8-bit)
  8565. transfers.  The OFFSET is a physical address, which can be computed
  8566. from a real-mode segment/offset pair as follows:
  8567.  
  8568.      offset = segment * 16 + offset;
  8569.  
  8570. The XFERS is the number of bytes to transfer, and BUFFER is a pointer
  8571. to somewhere in your virtual address space (such as memory obtained
  8572. from `malloc') where the data will come from.
  8573.  
  8574. Return Value
  8575. ------------
  8576.  
  8577. None.
  8578.  
  8579. Portability
  8580. -----------
  8581.  
  8582. not ANSI, not POSIX
  8583.  
  8584. Example
  8585. -------
  8586.  
  8587.      unsigned short save_screen[25][80];
  8588.      _dosmemputb(save_screen, 0xb8000, 80*2*25);
  8589.  
  8590. 
  8591. File: libc.info,  Node: dosmemputl,  Next: dosmemputw,  Prev: dosmemputb,  Up: Alphabetical List
  8592.  
  8593. dosmemputl
  8594. ==========
  8595.  
  8596. Syntax
  8597. ------
  8598.  
  8599.      #include <sys/movedata.h>
  8600.      
  8601.      void _dosmemputl(const void *buffer, size_t xfers, unsigned long offset);
  8602.  
  8603. Description
  8604. -----------
  8605.  
  8606. This function transfers data from the program's virtual address space
  8607. to MS-DOS's conventional memory space, using only long-word (32-bit)
  8608. transfers.  The OFFSET is a physical address, which can be computed
  8609. from a real-mode segment/offset pair as follows:
  8610.  
  8611.      offset = segment * 16 + offset;
  8612.  
  8613. The XFERS is the number of long-words to transfer, and BUFFER is a
  8614. pointer to somewhere in your virtual address space (such as memory
  8615. obtained from `malloc') where the data will come from.
  8616.  
  8617. Return Value
  8618. ------------
  8619.  
  8620. None.
  8621.  
  8622. Portability
  8623. -----------
  8624.  
  8625. not ANSI, not POSIX
  8626.  
  8627. Example
  8628. -------
  8629.  
  8630.      unsigned short save_screen[25][80];
  8631.      _dosmemputl(save_screen, 40*25, 0xb8000);
  8632.  
  8633. 
  8634. File: libc.info,  Node: dosmemputw,  Next: DPMI Overview,  Prev: dosmemputl,  Up: Alphabetical List
  8635.  
  8636. dosmemputw
  8637. ==========
  8638.  
  8639. Syntax
  8640. ------
  8641.  
  8642.      #include <sys/movedata.h>
  8643.      
  8644.      void _dosmemputw(const void *buffer, size_t xfers, unsigned long offset);
  8645.  
  8646. Description
  8647. -----------
  8648.  
  8649. This function transfers data from the program's virtual address space
  8650. to MS-DOS's conventional memory space, using only short-word (16-bit)
  8651. transfers.  The OFFSET is a physical address, which can be computed
  8652. from a real-mode segment/offset pair as follows:
  8653.  
  8654.      offset = segment * 16 + offset;
  8655.  
  8656. The XFERS is the number of short-words to transfer, and BUFFER is a
  8657. pointer to somewhere in your virtual address space (such as memory
  8658. obtained from `malloc') where the data will come from.
  8659.  
  8660. Return Value
  8661. ------------
  8662.  
  8663. None.
  8664.  
  8665. Portability
  8666. -----------
  8667.  
  8668. not ANSI, not POSIX
  8669.  
  8670. Example
  8671. -------
  8672.  
  8673.      unsigned short save_screen[25][80];
  8674.      _dosmemputw(save_screen, 0xb8000, 80*25);
  8675.  
  8676. 
  8677. File: libc.info,  Node: DPMI Overview,  Next: DPMI Specification,  Prev: dosmemputw,  Up: Alphabetical List
  8678.  
  8679. DPMI Overview
  8680. =============
  8681.  
  8682.      extern unsigned short __dpmi_error;
  8683.  
  8684. For most functions, the error returned from the DPMI server is stored
  8685. in this variable.
  8686.  
  8687.      typedef struct {
  8688.        unsigned short offset16;
  8689.        unsigned short segment;
  8690.      } __dpmi_raddr;
  8691.  
  8692. This structure is used to hold a real-mode address, which consists of a
  8693. segment:offset pair.
  8694.  
  8695.      typedef struct {
  8696.        unsigned long  offset32;
  8697.        unsigned short selector;
  8698.      } __dpmi_paddr;
  8699.  
  8700. This structure is used to hold a protected-mode address, which consists
  8701. of a selector:offset pair.
  8702.  
  8703.      typedef struct {
  8704.        unsigned long handle;            /* 0, 2 */
  8705.        unsigned long size;     /* or count */    /* 4, 6 */
  8706.        unsigned long address;        /* 8, 10 */
  8707.      } __dpmi_meminfo;
  8708.  
  8709. This structure is used by many functions that need to refer to blocks
  8710. of 32-bit memory.  The `size' field doubles as a count for those
  8711. operations that want a count of something, or return a count.
  8712.  
  8713.      typedef union {
  8714.        struct {
  8715.          unsigned long edi;
  8716.          unsigned long esi;
  8717.          unsigned long ebp;
  8718.          unsigned long res;
  8719.          unsigned long ebx;
  8720.          unsigned long edx;
  8721.          unsigned long ecx;
  8722.          unsigned long eax;
  8723.        } d;
  8724.        struct {
  8725.          unsigned short di, di_hi;
  8726.          unsigned short si, si_hi;
  8727.          unsigned short bp, bp_hi;
  8728.          unsigned short res, res_hi;
  8729.          unsigned short bx, bx_hi;
  8730.          unsigned short dx, dx_hi;
  8731.          unsigned short cx, cx_hi;
  8732.          unsigned short ax, ax_hi;
  8733.          unsigned short flags;
  8734.          unsigned short es;
  8735.          unsigned short ds;
  8736.          unsigned short fs;
  8737.          unsigned short gs;
  8738.          unsigned short ip;
  8739.          unsigned short cs;
  8740.          unsigned short sp;
  8741.          unsigned short ss;
  8742.        } x;
  8743.        struct {
  8744.          unsigned char edi[4];
  8745.          unsigned char esi[4];
  8746.          unsigned char ebp[4];
  8747.          unsigned char res[4];
  8748.          unsigned char bl, bh, ebx_b2, ebx_b3;
  8749.          unsigned char dl, dh, edx_b2, edx_b3;
  8750.          unsigned char cl, ch, ecx_b2, ecx_b3;
  8751.          unsigned char al, ah, eax_b2, eax_b3;
  8752.        } h;
  8753.      } __dpmi_regs;
  8754.  
  8755. This structure is used by functions that pass register information,
  8756. such as simulating real-mode calls.
  8757.  
  8758.      typedef struct {
  8759.        unsigned char  major;
  8760.        unsigned char  minor;
  8761.        unsigned short flags;
  8762.        unsigned char  cpu;
  8763.        unsigned char  master_pic;
  8764.        unsigned char  slave_pic;
  8765.      } __dpmi_version_ret;
  8766.  
  8767. This structure is used to return version information to the program.
  8768.  
  8769.      typedef struct {
  8770.        unsigned long largest_available_free_block_in_bytes;
  8771.        unsigned long maximum_unlocked_page_allocation_in_pages;
  8772.        unsigned long maximum_locked_page_allocation_in_pages;
  8773.        unsigned long linear_address_space_size_in_pages;
  8774.        unsigned long total_number_of_unlocked_pages;
  8775.        unsigned long total_number_of_free_pages;
  8776.        unsigned long total_number_of_physical_pages;
  8777.        unsigned long free_linear_address_space_in_pages;
  8778.        unsigned long size_of_paging_file_partition_in_pages;
  8779.        unsigned long reserved[3];
  8780.      } __dpmi_free_mem_info;
  8781.  
  8782. This structure is used to return information about the state of virtual
  8783. memory in the system.
  8784.  
  8785.      typedef struct {
  8786.        unsigned long total_allocated_bytes_of_physical_memory_host;
  8787.        unsigned long total_allocated_bytes_of_virtual_memory_host;
  8788.        unsigned long total_available_bytes_of_virtual_memory_host;
  8789.        unsigned long total_allocated_bytes_of_virtual_memory_vcpu;
  8790.        unsigned long total_available_bytes_of_virtual_memory_vcpu;
  8791.        unsigned long total_allocated_bytes_of_virtual_memory_client;
  8792.        unsigned long total_available_bytes_of_virtual_memory_client;
  8793.        unsigned long total_locked_bytes_of_memory_client;
  8794.        unsigned long max_locked_bytes_of_memory_client;
  8795.        unsigned long highest_linear_address_available_to_client;
  8796.        unsigned long size_in_bytes_of_largest_free_memory_block;
  8797.        unsigned long size_of_minimum_allocation_unit_in_bytes;
  8798.        unsigned long size_of_allocation_alignment_unit_in_bytes;
  8799.        unsigned long reserved[19];
  8800.      } __dpmi_memory_info;
  8801.  
  8802. This is also used to return memory information, but by a different
  8803. function.
  8804.  
  8805.      typedef struct {
  8806.        unsigned long data16[2];
  8807.        unsigned long code16[2];
  8808.        unsigned short ip;
  8809.        unsigned short reserved;
  8810.        unsigned long data32[2];
  8811.        unsigned long code32[2];
  8812.        unsigned long eip;
  8813.      } __dpmi_callback_info;
  8814.  
  8815. This structure is used to install TSR programs.
  8816.  
  8817.      typedef struct {
  8818.        unsigned long size_requested;
  8819.        unsigned long size;
  8820.        unsigned long handle;
  8821.        unsigned long address;
  8822.        unsigned long name_offset;
  8823.        unsigned short name_selector;
  8824.        unsigned short reserved1;
  8825.        unsigned long reserved2;
  8826.      } __dpmi_shminfo;
  8827.  
  8828. This structure is used to manipulate shared memory regions.
  8829.  
  8830. 
  8831. File: libc.info,  Node: DPMI Specification,  Next: __dpmi_allocate_dos_memory,  Prev: DPMI Overview,  Up: Alphabetical List
  8832.  
  8833. DPMI Specification
  8834. ==================
  8835.  
  8836. To obtain the DPMI specification, Contact Intel and order document
  8837. number 240977-001.  Also, try ftp.qdeck.com:/pub/memory/dpmi* and
  8838. http://www.delorie.com/djgpp/doc/dpmi/.
  8839.  
  8840. 
  8841. File: libc.info,  Node: __dpmi_allocate_dos_memory,  Next: __dpmi_allocate_ldt_descriptors,  Prev: DPMI Specification,  Up: Alphabetical List
  8842.  
  8843. __dpmi_allocate_dos_memory
  8844. ==========================
  8845.  
  8846. Syntax
  8847. ------
  8848.  
  8849.      #include <dpmi.h>
  8850.      
  8851.      int __dpmi_allocate_dos_memory(int _paragraphs, int *_ret_selector_or_max);
  8852.  
  8853. Description
  8854. -----------
  8855.  
  8856. Please refer to *Note DPMI Specification:: for details on DPMI function
  8857. call operation.  Also see *Note DPMI Overview:: for general information.
  8858.  
  8859. DPMI function AX = 0x0100
  8860.  
  8861. This function allocates DOS memory.  You pass it the number of
  8862. paragraphs ((bytes+15)>>4) to allocate.  If it succeeds, it returns a
  8863. segment (dos-style) and fills in _RET_SELECTOR_OR_MAX with a selector
  8864. (protected-mode) that you can use to reference the same memory.  Note
  8865. that it's the selector you use to free the block, not the segment.
  8866.  
  8867. Return Value
  8868. ------------
  8869.  
  8870. -1 on error, else the segment [0000..FFFF].
  8871.  
  8872. Portability
  8873. -----------
  8874.  
  8875. not ANSI, not POSIX
  8876.  
  8877. 
  8878. File: libc.info,  Node: __dpmi_allocate_ldt_descriptors,  Next: __dpmi_allocate_linear_memory,  Prev: __dpmi_allocate_dos_memory,  Up: Alphabetical List
  8879.  
  8880. __dpmi_allocate_ldt_descriptors
  8881. ===============================
  8882.  
  8883. Syntax
  8884. ------
  8885.  
  8886.      #include <dpmi.h>
  8887.      
  8888.      int __dpmi_allocate_ldt_descriptors(int count);
  8889.  
  8890. Description
  8891. -----------
  8892.  
  8893. Please refer to *Note DPMI Specification:: for details on DPMI function
  8894. call operation.  Also see *Note DPMI Overview:: for general information.
  8895.  
  8896. DPMI function AX = 0x0000
  8897.  
  8898. Allocates COUNT descriptors.
  8899.  
  8900. Return Value
  8901. ------------
  8902.  
  8903. -1 on error, else the first descriptor.  Use *Note
  8904. __dpmi_get_selector_increment_value:: to figure out the remaining
  8905. selectors.
  8906.  
  8907. Portability
  8908. -----------
  8909.  
  8910. not ANSI, not POSIX
  8911.  
  8912. Example
  8913. -------
  8914.  
  8915.      short sel = __dpmi_allocate_ldt_descriptors(1);
  8916.  
  8917. 
  8918. File: libc.info,  Node: __dpmi_allocate_linear_memory,  Next: __dpmi_allocate_memory,  Prev: __dpmi_allocate_ldt_descriptors,  Up: Alphabetical List
  8919.  
  8920. __dpmi_allocate_linear_memory
  8921. =============================
  8922.  
  8923. Syntax
  8924. ------
  8925.  
  8926.      #include <dpmi.h>
  8927.      
  8928.      int __dpmi_allocate_linear_memory(__dpmi_meminfo *info, int commit);
  8929.  
  8930. Description
  8931. -----------
  8932.  
  8933. Please refer to *Note DPMI Specification:: for details on DPMI function
  8934. call operation.  Also see *Note DPMI Overview:: for general information.
  8935.  
  8936. DPMI function AX = 0x0504 (DPMI 1.0 only).  Not supported by CWSDPMI and
  8937. Windows.
  8938.  
  8939. This allocates a block of page-aligned linear address space.  Pass a
  8940. desired address (or zero for any) and a size.  COMMIT is 1 for
  8941. committed pages, else they are uncommitted.  It returns a handle and
  8942. the actual address.
  8943.  
  8944. Return Value
  8945. ------------
  8946.  
  8947. -1 on error, else zero.
  8948.  
  8949. Portability
  8950. -----------
  8951.  
  8952. not ANSI, not POSIX
  8953.  
  8954. 
  8955. File: libc.info,  Node: __dpmi_allocate_memory,  Next: __dpmi_allocate_real_mode_callback,  Prev: __dpmi_allocate_linear_memory,  Up: Alphabetical List
  8956.  
  8957. __dpmi_allocate_memory
  8958. ======================
  8959.  
  8960. Syntax
  8961. ------
  8962.  
  8963.      #include <dpmi.h>
  8964.      
  8965.      int __dpmi_allocate_memory(__dpmi_meminfo *_info);
  8966.  
  8967. Description
  8968. -----------
  8969.  
  8970. Please refer to *Note DPMI Specification:: for details on DPMI function
  8971. call operation.  Also see *Note DPMI Overview:: for general information.
  8972.  
  8973. DPMI function AX = 0x0501
  8974.  
  8975. This allocates virtual memory.  Fill in size, returns handle and
  8976. address.
  8977.  
  8978. Return Value
  8979. ------------
  8980.  
  8981. -1 on error, else zero.
  8982.  
  8983. Portability
  8984. -----------
  8985.  
  8986. not ANSI, not POSIX
  8987.  
  8988. 
  8989. File: libc.info,  Node: __dpmi_allocate_real_mode_callback,  Next: __dpmi_allocate_shared_memory,  Prev: __dpmi_allocate_memory,  Up: Alphabetical List
  8990.  
  8991. __dpmi_allocate_real_mode_callback
  8992. ==================================
  8993.  
  8994. Syntax
  8995. ------
  8996.  
  8997.      #include <dpmi.h>
  8998.      
  8999.      int __dpmi_allocate_real_mode_callback(void (*_handler)(void), __dpmi_regs *_regs, __dpmi_raddr *_ret);
  9000.  
  9001. Description
  9002. -----------
  9003.  
  9004. Please refer to *Note DPMI Specification:: for details on DPMI function
  9005. call operation.  Also see *Note DPMI Overview:: for general information.
  9006.  
  9007. DPMI function AX = 0x0303
  9008.  
  9009. This function gives you a real-mode address to pass to TSRs that gets
  9010. reflected to your protected-mode handler.  You pass it a register block
  9011. to use; it gets filled in with the real-mode registers when your
  9012. handler is called, and the registers are set from it when the handler
  9013. returns.
  9014.  
  9015. Return Value
  9016. ------------
  9017.  
  9018. -1 on error, else zero.
  9019.  
  9020. Portability
  9021. -----------
  9022.  
  9023. not ANSI, not POSIX
  9024.  
  9025. 
  9026. File: libc.info,  Node: __dpmi_allocate_shared_memory,  Next: __dpmi_allocate_specific_ldt_descriptor,  Prev: __dpmi_allocate_real_mode_callback,  Up: Alphabetical List
  9027.  
  9028. __dpmi_allocate_shared_memory
  9029. =============================
  9030.  
  9031. Syntax
  9032. ------
  9033.  
  9034.      #include <dpmi.h>
  9035.      
  9036.      int __dpmi_allocate_shared_memory(__dpmi_shminfo *info);
  9037.  
  9038. Description
  9039. -----------
  9040.  
  9041. Please refer to *Note DPMI Specification:: for details on DPMI function
  9042. call operation.  Also see *Note DPMI Overview:: for general information.
  9043.  
  9044. DPMI function AX = 0x0d00 (DPMI 1.0 only).  Not supported by CWSDPMI and
  9045. Windows.
  9046.  
  9047. This function allocates a shared memory block that can be accessed from
  9048. different virtual machines.  Fill the required length in
  9049. `INFO->size_requested'.  The function fills the rest of the structure:
  9050. allocated length in `INFO->size', block handle in `INFO->handle',
  9051. linear address in `INFO->address', and the selector:offset of an ASCIIZ
  9052. block name (up to 128 bytes long) in `INFO->name_selector' and
  9053. `INFO->name_offset', respectively.
  9054.  
  9055. The access to the shared memory block can be serialized by calling the
  9056. `__dpmi_serialize_on_shared_memory' function (*note
  9057. __dpmi_serialize_on_shared_memory::.).
  9058.  
  9059. Return Value
  9060. ------------
  9061.  
  9062. -1 on error, else zero.
  9063.  
  9064. Portability
  9065. -----------
  9066.  
  9067. not ANSI, not POSIX
  9068.  
  9069. 
  9070. File: libc.info,  Node: __dpmi_allocate_specific_ldt_descriptor,  Next: __dpmi_clear_debug_watchpoint,  Prev: __dpmi_allocate_shared_memory,  Up: Alphabetical List
  9071.  
  9072. __dpmi_allocate_specific_ldt_descriptor
  9073. =======================================
  9074.  
  9075. Syntax
  9076. ------
  9077.  
  9078.      #include <dpmi.h>
  9079.      
  9080.      int __dpmi_allocate_specific_ldt_descriptor(int _selector);
  9081.  
  9082. Description
  9083. -----------
  9084.  
  9085. Please refer to *Note DPMI Specification:: for details on DPMI function
  9086. call operation.  Also see *Note DPMI Overview:: for general information.
  9087.  
  9088. DPMI function AX = 0x000d
  9089.  
  9090. This allocates the specific selector given.
  9091.  
  9092. Return Value
  9093. ------------
  9094.  
  9095. -1 on error, else zero.
  9096.  
  9097. Portability
  9098. -----------
  9099.  
  9100. not ANSI, not POSIX
  9101.  
  9102. 
  9103. File: libc.info,  Node: __dpmi_clear_debug_watchpoint,  Next: __dpmi_create_alias_descriptor,  Prev: __dpmi_allocate_specific_ldt_descriptor,  Up: Alphabetical List
  9104.  
  9105. __dpmi_clear_debug_watchpoint
  9106. =============================
  9107.  
  9108. Syntax
  9109. ------
  9110.  
  9111.      #include <dpmi.h>
  9112.      
  9113.      int __dpmi_clear_debug_watchpoint(unsigned long _handle);
  9114.  
  9115. Description
  9116. -----------
  9117.  
  9118. Please refer to *Note DPMI Specification:: for details on DPMI function
  9119. call operation.  Also see *Note DPMI Overview:: for general information.
  9120.  
  9121. DPMI function AX = 0x0b01
  9122.  
  9123. Clear a debug watchpoint.
  9124.  
  9125. Return Value
  9126. ------------
  9127.  
  9128. -1 on error, else zero.
  9129.  
  9130. Portability
  9131. -----------
  9132.  
  9133. not ANSI, not POSIX
  9134.  
  9135. 
  9136. File: libc.info,  Node: __dpmi_create_alias_descriptor,  Next: __dpmi_discard_page_contents,  Prev: __dpmi_clear_debug_watchpoint,  Up: Alphabetical List
  9137.  
  9138. __dpmi_create_alias_descriptor
  9139. ==============================
  9140.  
  9141. Syntax
  9142. ------
  9143.  
  9144.      #include <dpmi.h>
  9145.      
  9146.      int __dpmi_create_alias_descriptor(int _selector);
  9147.  
  9148. Description
  9149. -----------
  9150.  
  9151. Please refer to *Note DPMI Specification:: for details on DPMI function
  9152. call operation.  Also see *Note DPMI Overview:: for general information.
  9153.  
  9154. DPMI function AX = 0x000a
  9155.  
  9156. Create a new selector with the same parameters as the given one.
  9157.  
  9158. Return Value
  9159. ------------
  9160.  
  9161. -1 on error, else the new selector.
  9162.  
  9163. Portability
  9164. -----------
  9165.  
  9166. not ANSI, not POSIX
  9167.  
  9168. 
  9169. File: libc.info,  Node: __dpmi_discard_page_contents,  Next: __dpmi_free_dos_memory,  Prev: __dpmi_create_alias_descriptor,  Up: Alphabetical List
  9170.  
  9171. __dpmi_discard_page_contents
  9172. ============================
  9173.  
  9174. Syntax
  9175. ------
  9176.  
  9177.      #include <dpmi.h>
  9178.      
  9179.      int __dpmi_discard_page_contents(__dpmi_meminfo *_info);
  9180.  
  9181. Description
  9182. -----------
  9183.  
  9184. Please refer to *Note DPMI Specification:: for details on DPMI function
  9185. call operation.  Also see *Note DPMI Overview:: for general information.
  9186.  
  9187. DPMI function AX = 0x0703
  9188.  
  9189. Advises the server that the given pages are no longer needed and may be
  9190. reclaimed.  Fill in address and size (in bytes).
  9191.  
  9192. Return Value
  9193. ------------
  9194.  
  9195. -1 on error, else zero.
  9196.  
  9197. Portability
  9198. -----------
  9199.  
  9200. not ANSI, not POSIX
  9201.  
  9202. 
  9203. File: libc.info,  Node: __dpmi_free_dos_memory,  Next: __dpmi_free_ldt_descriptor,  Prev: __dpmi_discard_page_contents,  Up: Alphabetical List
  9204.  
  9205. __dpmi_free_dos_memory
  9206. ======================
  9207.  
  9208. Syntax
  9209. ------
  9210.  
  9211.      #include <dpmi.h>
  9212.      
  9213.      int __dpmi_free_dos_memory(int _selector);
  9214.  
  9215. Description
  9216. -----------
  9217.  
  9218. Please refer to *Note DPMI Specification:: for details on DPMI function
  9219. call operation.  Also see *Note DPMI Overview:: for general information.
  9220.  
  9221. DPMI function AX = 0x0101
  9222.  
  9223. This function frees the dos memory allocated by *Note
  9224. __dpmi_allocate_dos_memory::.  Remember to pass the selector and not
  9225. the segment.
  9226.  
  9227. Return Value
  9228. ------------
  9229.  
  9230. -1 on error, else zero.
  9231.  
  9232. Portability
  9233. -----------
  9234.  
  9235. not ANSI, not POSIX
  9236.  
  9237. 
  9238. File: libc.info,  Node: __dpmi_free_ldt_descriptor,  Next: __dpmi_free_memory,  Prev: __dpmi_free_dos_memory,  Up: Alphabetical List
  9239.  
  9240. __dpmi_free_ldt_descriptor
  9241. ==========================
  9242.  
  9243. Syntax
  9244. ------
  9245.  
  9246.      #include <dpmi.h>
  9247.      
  9248.      int __dpmi_free_ldt_descriptor(int descriptor);
  9249.  
  9250. Description
  9251. -----------
  9252.  
  9253. Please refer to *Note DPMI Specification:: for details on DPMI function
  9254. call operation.  Also see *Note DPMI Overview:: for general information.
  9255.  
  9256. DPMI function AX = 0x0001
  9257.  
  9258. This function frees a single descriptor, even if it was allocated as
  9259. one of many.
  9260.  
  9261. Return Value
  9262. ------------
  9263.  
  9264. -1 on error, else zero.
  9265.  
  9266. Portability
  9267. -----------
  9268.  
  9269. not ANSI, not POSIX
  9270.  
  9271. Example
  9272. -------
  9273.  
  9274.      __dpmi_free_ldt_descriptor(sel);
  9275.  
  9276. 
  9277. File: libc.info,  Node: __dpmi_free_memory,  Next: __dpmi_free_physical_address_mapping,  Prev: __dpmi_free_ldt_descriptor,  Up: Alphabetical List
  9278.  
  9279. __dpmi_free_memory
  9280. ==================
  9281.  
  9282. Syntax
  9283. ------
  9284.  
  9285.      #include <dpmi.h>
  9286.      
  9287.      int __dpmi_free_memory(unsigned long _handle);
  9288.  
  9289. Description
  9290. -----------
  9291.  
  9292. Please refer to *Note DPMI Specification:: for details on DPMI function
  9293. call operation.  Also see *Note DPMI Overview:: for general information.
  9294.  
  9295. DPMI function AX = 0x0502
  9296.  
  9297. This frees a block of virtual memory.
  9298.  
  9299. Return Value
  9300. ------------
  9301.  
  9302. -1 on error, else zero.
  9303.  
  9304. Portability
  9305. -----------
  9306.  
  9307. not ANSI, not POSIX
  9308.  
  9309. 
  9310. File: libc.info,  Node: __dpmi_free_physical_address_mapping,  Next: __dpmi_free_real_mode_callback,  Prev: __dpmi_free_memory,  Up: Alphabetical List
  9311.  
  9312. __dpmi_free_physical_address_mapping
  9313. ====================================
  9314.  
  9315. Syntax
  9316. ------
  9317.  
  9318.      #include <dpmi.h>
  9319.      
  9320.      int __dpmi_free_physical_address_mapping(__dpmi_meminfo *info);
  9321.  
  9322. Description
  9323. -----------
  9324.  
  9325. Please refer to *Note DPMI Specification:: for details on DPMI function
  9326. call operation.  Also see *Note DPMI Overview:: for general information.
  9327.  
  9328. DPMI function AX = 0x0801 (DPMI 1.0 only).  Not supported by CWSDPMI and
  9329. Windows.
  9330.  
  9331. This function unmaps a physical device mapped with *Note
  9332. __dpmi_physical_address_mapping::.  Fill in the linear address.
  9333.  
  9334. Return Value
  9335. ------------
  9336.  
  9337. -1 on error, else zero.
  9338.  
  9339. Portability
  9340. -----------
  9341.  
  9342. not ANSI, not POSIX
  9343.  
  9344. 
  9345. File: libc.info,  Node: __dpmi_free_real_mode_callback,  Next: __dpmi_free_serialization_on_shared_memory,  Prev: __dpmi_free_physical_address_mapping,  Up: Alphabetical List
  9346.  
  9347. __dpmi_free_real_mode_callback
  9348. ==============================
  9349.  
  9350. Syntax
  9351. ------
  9352.  
  9353.      #include <dpmi.h>
  9354.      
  9355.      int __dpmi_free_real_mode_callback(__dpmi_raddr *_addr);
  9356.  
  9357. Description
  9358. -----------
  9359.  
  9360. Please refer to *Note DPMI Specification:: for details on DPMI function
  9361. call operation.  Also see *Note DPMI Overview:: for general information.
  9362.  
  9363. DPMI function AX = 0x0303
  9364.  
  9365. This function frees the real-mode callback address.
  9366.  
  9367. Return Value
  9368. ------------
  9369.  
  9370. -1 on error, else zero.
  9371.  
  9372. Portability
  9373. -----------
  9374.  
  9375. not ANSI, not POSIX
  9376.  
  9377. 
  9378. File: libc.info,  Node: __dpmi_free_serialization_on_shared_memory,  Next: __dpmi_free_shared_memory,  Prev: __dpmi_free_real_mode_callback,  Up: Alphabetical List
  9379.  
  9380. __dpmi_free_serialization_on_shared_memory
  9381. ==========================================
  9382.  
  9383. Syntax
  9384. ------
  9385.  
  9386.      #include <dpmi.h>
  9387.      
  9388.      int __dpmi_free_serialization_on_shared_memory(unsigned long handle,
  9389.                                                     int flags);
  9390.  
  9391. Description
  9392. -----------
  9393.  
  9394. Please refer to *Note DPMI Specification:: for details on DPMI function
  9395. call operation.  Also see *Note DPMI Overview:: for general information.
  9396.  
  9397. DPMI function AX = 0x0d03 (DPMI 1.0 only).  Not supported by CWSDPMI and
  9398. Windows.
  9399.  
  9400. This function frees the serialization on shared memory block specified
  9401. by its handle HANDLE.  The bit-mapped variable FLAGS defines the
  9402. following bits:
  9403.  
  9404. bit 0
  9405.      If set, release shared serialization (as opposed to exclusive
  9406.      serialization).
  9407.  
  9408. bit 1
  9409.      If set, free pending serialization.
  9410.  
  9411. bits 2-15
  9412.      Reserved (should be zero).
  9413.  
  9414. Return Value
  9415. ------------
  9416.  
  9417. -1 on error, else zero.
  9418.  
  9419. Portability
  9420. -----------
  9421.  
  9422. not ANSI, not POSIX
  9423.  
  9424. 
  9425. File: libc.info,  Node: __dpmi_free_shared_memory,  Next: __dpmi_get_and_disable_virtual_interrupt_state,  Prev: __dpmi_free_serialization_on_shared_memory,  Up: Alphabetical List
  9426.  
  9427. __dpmi_free_shared_memory
  9428. =========================
  9429.  
  9430. Syntax
  9431. ------
  9432.  
  9433.      #include <dpmi.h>
  9434.      
  9435.      int __dpmi_free_shared_memory(unsigned long handle);
  9436.  
  9437. Description
  9438. -----------
  9439.  
  9440. Please refer to *Note DPMI Specification:: for details on DPMI function
  9441. call operation.  Also see *Note DPMI Overview:: for general information.
  9442.  
  9443. DPMI function AX = 0x0d01 (DPMI 1.0 only).  Not supported by CWSDPMI and
  9444. Windows.
  9445.  
  9446. This function frees the shared memory block specified by the given
  9447. HANDLE.  The handle becomes invalid after this call.
  9448.  
  9449. Return Value
  9450. ------------
  9451.  
  9452. -1 on error, else zero.
  9453.  
  9454. Portability
  9455. -----------
  9456.  
  9457. not ANSI, not POSIX
  9458.  
  9459. 
  9460. File: libc.info,  Node: __dpmi_get_and_disable_virtual_interrupt_state,  Next: __dpmi_get_and_enable_virtual_interrupt_state,  Prev: __dpmi_free_shared_memory,  Up: Alphabetical List
  9461.  
  9462. __dpmi_get_and_disable_virtual_interrupt_state
  9463. ==============================================
  9464.  
  9465. Syntax
  9466. ------
  9467.  
  9468.      #include <dpmi.h>
  9469.      
  9470.      int __dpmi_get_and_disable_virtual_interrupt_state(void);
  9471.  
  9472. Description
  9473. -----------
  9474.  
  9475. Please refer to *Note DPMI Specification:: for details on DPMI function
  9476. call operation.  Also see *Note DPMI Overview:: for general information.
  9477.  
  9478. DPMI function AX = 0x0900
  9479.  
  9480. This function disables interrupts, and returns the previous setting.
  9481.  
  9482. Return Value
  9483. ------------
  9484.  
  9485. The previous setting.
  9486.  
  9487. Portability
  9488. -----------
  9489.  
  9490. not ANSI, not POSIX
  9491.  
  9492. 
  9493. File: libc.info,  Node: __dpmi_get_and_enable_virtual_interrupt_state,  Next: __dpmi_get_and_set_virtual_interrupt_state,  Prev: __dpmi_get_and_disable_virtual_interrupt_state,  Up: Alphabetical List
  9494.  
  9495. __dpmi_get_and_enable_virtual_interrupt_state
  9496. =============================================
  9497.  
  9498. Syntax
  9499. ------
  9500.  
  9501.      #include <dpmi.h>
  9502.      
  9503.      int __dpmi_get_and_enable_virtual_interrupt_state(void);
  9504.  
  9505. Description
  9506. -----------
  9507.  
  9508. Please refer to *Note DPMI Specification:: for details on DPMI function
  9509. call operation.  Also see *Note DPMI Overview:: for general information.
  9510.  
  9511. DPMI function AX = 0x0901
  9512.  
  9513. This function enables interrupts, and returns the previous setting.
  9514.  
  9515. Return Value
  9516. ------------
  9517.  
  9518. The previous setting.
  9519.  
  9520. Portability
  9521. -----------
  9522.  
  9523. not ANSI, not POSIX
  9524.  
  9525. 
  9526. File: libc.info,  Node: __dpmi_get_and_set_virtual_interrupt_state,  Next: __dpmi_get_capabilities,  Prev: __dpmi_get_and_enable_virtual_interrupt_state,  Up: Alphabetical List
  9527.  
  9528. __dpmi_get_and_set_virtual_interrupt_state
  9529. ==========================================
  9530.  
  9531. Syntax
  9532. ------
  9533.  
  9534.      #include <dpmi.h>
  9535.      
  9536.      int __dpmi_get_and_set_virtual_interrupt_state(int _old_state);
  9537.  
  9538. Description
  9539. -----------
  9540.  
  9541. Please refer to *Note DPMI Specification:: for details on DPMI function
  9542. call operation.  Also see *Note DPMI Overview:: for general information.
  9543.  
  9544. DPMI function AH = 0x09
  9545.  
  9546. This function restores the interrupt state from a previous call to
  9547. *Note __dpmi_get_and_disable_virtual_interrupt_state:: or *Note
  9548. __dpmi_get_and_enable_virtual_interrupt_state::.
  9549.  
  9550. Return Value
  9551. ------------
  9552.  
  9553. The previous setting.
  9554.  
  9555. Portability
  9556. -----------
  9557.  
  9558. not ANSI, not POSIX
  9559.  
  9560. 
  9561. File: libc.info,  Node: __dpmi_get_capabilities,  Next: __dpmi_get_coprocessor_status,  Prev: __dpmi_get_and_set_virtual_interrupt_state,  Up: Alphabetical List
  9562.  
  9563. __dpmi_get_capabilities
  9564. =======================
  9565.  
  9566. Syntax
  9567. ------
  9568.  
  9569.      #include <dpmi.h>
  9570.      
  9571.      int __dpmi_get_capabilities(int *flags, char *vendor_info);
  9572.  
  9573. Description
  9574. -----------
  9575.  
  9576. Please refer to *Note DPMI Specification:: for details on DPMI function
  9577. call operation.  Also see *Note DPMI Overview:: for general information.
  9578.  
  9579. DPMI function AX = 0x0401 (DPMI 1.0 only).  Not supported by CWSDPMI and
  9580. Windows.
  9581.  
  9582. Gets the capabilities of the server.  FLAGS are as follows:
  9583.  
  9584.      ---- ---X = 1="page accessed/dirty" supported
  9585.      ---- --X- = 1="exceptions restartble" supported
  9586.      ---- -X-- = 1="device mapping" supported
  9587.      ---- X--- = 1="map conventional memory" supported
  9588.      ---X ---- = 1="demand zero-fill" supported
  9589.      --X- ---- = 1="write-protect client" supported
  9590.      -X-- ---- = 1="write-protect host" supported
  9591.  
  9592. The vendor info is a 128-byte buffer:
  9593.  
  9594.      [0] host major number
  9595.      [1] host minor number
  9596.      [2..127] vendor name
  9597.  
  9598. Return Value
  9599. ------------
  9600.  
  9601. -1 on error, else zero.
  9602.  
  9603. Portability
  9604. -----------
  9605.  
  9606. not ANSI, not POSIX
  9607.  
  9608. 
  9609. File: libc.info,  Node: __dpmi_get_coprocessor_status,  Next: __dpmi_get_descriptor,  Prev: __dpmi_get_capabilities,  Up: Alphabetical List
  9610.  
  9611. __dpmi_get_coprocessor_status
  9612. =============================
  9613.  
  9614. Syntax
  9615. ------
  9616.  
  9617.      #include <dpmi.h>
  9618.      
  9619.      int __dpmi_get_coprocessor_status(void);
  9620.  
  9621. Description
  9622. -----------
  9623.  
  9624. Please refer to *Note DPMI Specification::, for details on DPMI
  9625. function call operation.  Also see *Note DPMI Overview::, for general
  9626. information.
  9627.  
  9628. DPMI function AX = 0x0e00 (DPMI 1.0 only).  Not supported by CWSDPMI and
  9629. Windows.
  9630.  
  9631. Return Value
  9632. ------------
  9633.  
  9634. -1 on error, else returns the processor status flags.  Here's the
  9635. meaning of each set bit:
  9636.  
  9637. bit 0
  9638.      If set, co-processor is enabled.  If reset, co-processor is
  9639.      disabled.
  9640.  
  9641. bit 1
  9642.      If set, the application is emulating the co-processor.
  9643.  
  9644. bit 2
  9645.      If set, the numeric co-processor is present.
  9646.  
  9647. bit 3
  9648.      If set, the DPMI host is emulating the co-processor.
  9649.  
  9650. bits 4-7
  9651.      The co-processor type:
  9652.  
  9653.     `0000'
  9654.           none
  9655.  
  9656.     `0010'
  9657.           80287
  9658.  
  9659.     `0011'
  9660.           80387
  9661.  
  9662.     `0100'
  9663.           80486 with a numeric processor
  9664.  
  9665. Portability
  9666. -----------
  9667.  
  9668. not ANSI, not POSIX
  9669.  
  9670. 
  9671. File: libc.info,  Node: __dpmi_get_descriptor,  Next: __dpmi_get_descriptor_access_rights,  Prev: __dpmi_get_coprocessor_status,  Up: Alphabetical List
  9672.  
  9673. __dpmi_get_descriptor
  9674. =====================
  9675.  
  9676. Syntax
  9677. ------
  9678.  
  9679.      #include <dpmi.h>
  9680.      
  9681.      int __dpmi_get_descriptor(int _selector, void *_buffer);
  9682.  
  9683. Description
  9684. -----------
  9685.  
  9686. Please refer to *Note DPMI Specification:: for details on DPMI function
  9687. call operation.  Also see *Note DPMI Overview:: for general information.
  9688.  
  9689. DPMI function AX = 0x000b
  9690.  
  9691. This function fills the 8-byte buffer pointed to by _BUFFER with the
  9692. parameters of the descriptor whose selector is passed in _SELECTOR.
  9693. The data has the following format:
  9694.  
  9695.      [0] XXXX XXXX = segment limit [7:0]
  9696.      [1] XXXX XXXX = segment limit [15:8]
  9697.      [2] XXXX XXXX = base address [7:0]
  9698.      [3] XXXX XXXX = base address [15:8]
  9699.      [4] XXXX XXXX = base address [23:16]
  9700.      [5] ---- XXXX = type; see details below
  9701.      [5] ---X ---- = 0=system, 1=application (must be 1)
  9702.      [5] -XX- ---- = privilege level, usually 3 (binary 11)
  9703.      [5] X--- ---- = 0=absent, 1=present; usually 1
  9704.      [6] ---- XXXX = segment limit [19:16]
  9705.      [6] ---X ---- = available for user; see details below
  9706.      [6] --0- ---- = must be zero
  9707.      [6] -X-- ---- = 0=16-bit 1=32-bit; usually 1
  9708.      [6] X--- ---- = 0=byte-granular (small) 1=page-granular (big)
  9709.      [7] XXXX XXXX = base address [31:24]
  9710.  
  9711. Here's an alternative view of the layout that treats the buffer as an
  9712. array of 4 16-bit words (i.e., `unsigned short's):
  9713.  
  9714.      [0] XXXX XXXX XXXX XXXX = segment limit [15:0]
  9715.      [1] XXXX XXXX XXXX XXXX = base address  [15:0]
  9716.      [2] ---- ---- XXXX XXXX = base address [23:16]
  9717.      [2] ---- XXXX ---- ---- = type; see details below
  9718.      [2] ---1 ---- ---- ---- = 0=system, 1=application; must be 1
  9719.      [2] -XX- ---- ---- ---- = privilege level, usually 3 (binary 11)
  9720.      [2] X--- ---- ---- ---- = 0=absent, 1=present; usually 1
  9721.      [3] ---- ---- ---- XXXX = segment limit [19:16]
  9722.      [3] ---- ---- ---X ---- = available for user; see details below
  9723.      [3] ---- ---- --0- ---- = must be zero
  9724.      [3] ---- ---- -X-- ---- = 0=16-bit 1=32-bit; usually 1
  9725.      [3] ---- ---- X--- ---- = 0=byte-granular (small) 1=page-granular (big)
  9726.      [3] XXXX XXXX ---- ---- = base address [31:24]
  9727.  
  9728. Special considerations apply to some of the fields:
  9729.  
  9730. Segment Limit fields
  9731.      The segment limit is specified as a 20-bit number.  This number is
  9732.      interpreted as a number of bytes if the granularity bit (bit 7 of
  9733.      byte 6) is not set, and as a number of 4KB pages if the
  9734.      granularity bit is set.  Offsets larger than the limit will
  9735.      generate a "GPF", the General Protection Fault exception.
  9736.  
  9737.      For expand-down data segments (see below), the segment limit is the
  9738.      *lower* limit of the segment; the upper limit is either 0xffffffff
  9739.      or 0xffff, depending on whether the size bit is set (32-bit default
  9740.      size) or not (16-bit default size).  For expand-down segments,
  9741.      values of offset *less* than the segment limit result in a GPF.
  9742.  
  9743. Base Address fields
  9744.      Segment base address should generally be 16-byte aligned.  This is
  9745.      not required, but it maximizes performance by aligning code and
  9746.      data on 16-byte boundaries.
  9747.  
  9748. Type field
  9749.      This field has different meanings depending on whether the
  9750.      descriptor is for code or data segment.  For code segments, the
  9751.      meaning is as follows:
  9752.  
  9753.           ---X = 0=not accessed, 1=accessed
  9754.           --1- = 0=execute only, 1=execute/read; must be 1
  9755.           -0-- = 0=non-conforming, 1=conforming; must be 0
  9756.           1--- = 0=data segment, 1=code segment
  9757.  
  9758.      The accessed/not accessed bit indicates whether the segment has
  9759.      been accessed since the last time the bit was cleared.  This bit
  9760.      is set whenever the segment selector is loaded into a segment
  9761.      register, and the bit then remains set until explicitly cleared.
  9762.      This bit can be used for debugging purposes.
  9763.  
  9764.      The read bit must be set to allow reading data from the code
  9765.      segment, which is done in several cases by the library.  The DPMI
  9766.      spec (*note DPMI Specification::.) requires this bit to be 1 for
  9767.      code segments.
  9768.  
  9769.      The conforming bit must be cleared so that transfer of execution
  9770.      into this segment from a less-privileged segment will result in a
  9771.      GPF.  The DPMI spec (*note DPMI Specification::.) requires this
  9772.      bit to be 0 for code segments.
  9773.  
  9774.      For data segments, the meaning of the `type' field is as follows:
  9775.  
  9776.           ---X = 0=not accessed, 1=accessed
  9777.           --X- = 0=read-only, 1=read/write
  9778.           -X-- = 0=expand-up, 1=expand-down; usually 0
  9779.           0--- = 0=data segment, 1=code segment
  9780.  
  9781.      The accessed/not accessed bit has the same meaning as for code
  9782.      segments.  The expand up/down bit is meant to be 1 for stack
  9783.      segments whose size should be changed dynamically, whereby
  9784.      changing the limit adds the additional space to the bottom of the
  9785.      stack; for data segments and statically-sized stack segments, this
  9786.      bit is usually zero.
  9787.  
  9788. Present bit
  9789.      If this bit is clear, a segment-not-present exception will be
  9790.      generated when the selector is loaded into a segment register, and
  9791.      all the fields of the descriptor except the privilege level and
  9792.      the system/application bit are available for CPU/OS to store their
  9793.      own data.  Don't clear this bit unless you know what you are doing.
  9794.  
  9795. Available bit
  9796.      This bit is left for the application's use.  It is neither set nor
  9797.      cleared by the DPMI server.
  9798.  
  9799. Return Value
  9800. ------------
  9801.  
  9802. -1 on error, else zero.
  9803.  
  9804. Portability
  9805. -----------
  9806.  
  9807. not ANSI, not POSIX
  9808.  
  9809. 
  9810. File: libc.info,  Node: __dpmi_get_descriptor_access_rights,  Next: __dpmi_get_extended_exception_handler_vector_pm,  Prev: __dpmi_get_descriptor,  Up: Alphabetical List
  9811.  
  9812. __dpmi_get_descriptor_access_rights
  9813. ===================================
  9814.  
  9815. Syntax
  9816. ------
  9817.  
  9818.      #include <dpmi.h>
  9819.      
  9820.      int __dpmi_get_descriptor_access_rights(int _selector);
  9821.  
  9822. Description
  9823. -----------
  9824.  
  9825. Please refer to *Note DPMI Specification:: for details on DPMI function
  9826. call operation.  Also see *Note DPMI Overview:: for general information.
  9827.  
  9828. This function returns the access rights byte from the `lar' opcode.
  9829.  
  9830. Return Value
  9831. ------------
  9832.  
  9833. The access byte.  *Note __dpmi_set_descriptor_access_rights::, for the
  9834. details about the access information returned.  Also see *Note
  9835. __dpmi_get_descriptor::.
  9836.  
  9837. Portability
  9838. -----------
  9839.  
  9840. not ANSI, not POSIX
  9841.  
  9842. 
  9843. File: libc.info,  Node: __dpmi_get_extended_exception_handler_vector_pm,  Next: __dpmi_get_extended_exception_handler_vector_rm,  Prev: __dpmi_get_descriptor_access_rights,  Up: Alphabetical List
  9844.  
  9845. __dpmi_get_extended_exception_handler_vector_pm
  9846. ===============================================
  9847.  
  9848. Syntax
  9849. ------
  9850.  
  9851.      #include <dpmi.h>
  9852.      
  9853.      int __dpmi_get_extended_exception_handler_vector_pm(int vector,
  9854.                                                          __dpmi_paddr *address);
  9855.  
  9856. Description
  9857. -----------
  9858.  
  9859. Please refer to *Note DPMI Specification:: for details on DPMI function
  9860. call operation.  Also see *Note DPMI Overview:: for general information.
  9861.  
  9862. DPMI function AX = 0x0210 (DPMI 1.0 only).  Not supported by CWSDPMI and
  9863. Windows.
  9864.  
  9865. This gets the function that handles protected mode exceptions.
  9866.  
  9867. Return Value
  9868. ------------
  9869.  
  9870. -1 on error, else zero.
  9871.  
  9872. Portability
  9873. -----------
  9874.  
  9875. not ANSI, not POSIX
  9876.  
  9877. 
  9878. File: libc.info,  Node: __dpmi_get_extended_exception_handler_vector_rm,  Next: __dpmi_get_free_memory_information,  Prev: __dpmi_get_extended_exception_handler_vector_pm,  Up: Alphabetical List
  9879.  
  9880. __dpmi_get_extended_exception_handler_vector_rm
  9881. ===============================================
  9882.  
  9883. Syntax
  9884. ------
  9885.  
  9886.      #include <dpmi.h>
  9887.      
  9888.      int __dpmi_get_extended_exception_handler_vector_rm(int vector,
  9889.                                                          __dpmi_paddr *address);
  9890.  
  9891. Description
  9892. -----------
  9893.  
  9894. Please refer to *Note DPMI Specification:: for details on DPMI function
  9895. call operation.  Also see *Note DPMI Overview:: for general information.
  9896.  
  9897. DPMI function AX = 0x0211 (DPMI 1.0 only).  Not supported by CWSDPMI and
  9898. Windows.
  9899.  
  9900. This function gets the handler for real-mode exceptions.
  9901.  
  9902. Return Value
  9903. ------------
  9904.  
  9905. -1 on error, else zero.
  9906.  
  9907. Portability
  9908. -----------
  9909.  
  9910. not ANSI, not POSIX
  9911.  
  9912. 
  9913. File: libc.info,  Node: __dpmi_get_free_memory_information,  Next: __dpmi_get_memory_block_size_and_base,  Prev: __dpmi_get_extended_exception_handler_vector_rm,  Up: Alphabetical List
  9914.  
  9915. __dpmi_get_free_memory_information
  9916. ==================================
  9917.  
  9918. Syntax
  9919. ------
  9920.  
  9921.      #include <dpmi.h>
  9922.      
  9923.      int __dpmi_get_free_memory_information(__dpmi_free_mem_info *_info);
  9924.  
  9925. Description
  9926. -----------
  9927.  
  9928. Please refer to *Note DPMI Specification:: for details on DPMI function
  9929. call operation.  Also see *Note DPMI Overview:: for general information.
  9930.  
  9931. DPMI function AX = 0x0500
  9932.  
  9933. This function returns information about available memory.  Unsupported
  9934. fields will have -1 (0xfffffff) in them.
  9935.  
  9936. Return Value
  9937. ------------
  9938.  
  9939. Zero.  This always works.
  9940.  
  9941. Portability
  9942. -----------
  9943.  
  9944. not ANSI, not POSIX
  9945.  
  9946. 
  9947. File: libc.info,  Node: __dpmi_get_memory_block_size_and_base,  Next: __dpmi_get_memory_information,  Prev: __dpmi_get_free_memory_information,  Up: Alphabetical List
  9948.  
  9949. __dpmi_get_memory_block_size_and_base
  9950. =====================================
  9951.  
  9952. Syntax
  9953. ------
  9954.  
  9955.      #include <dpmi.h>
  9956.      
  9957.      int __dpmi_get_memory_block_size_and_base(__dpmi_meminfo *info);
  9958.  
  9959. Description
  9960. -----------
  9961.  
  9962. Please refer to *Note DPMI Specification:: for details on DPMI function
  9963. call operation.  Also see *Note DPMI Overview:: for general information.
  9964.  
  9965. DPMI function AX = 0x050a (DPMI 1.0 only).  Not supported by CWSDPMI and
  9966. Windows.
  9967.  
  9968. Pass the handle.  It fills in the address and size.
  9969.  
  9970. Return Value
  9971. ------------
  9972.  
  9973. -1 on error, else zero.
  9974.  
  9975. Portability
  9976. -----------
  9977.  
  9978. not ANSI, not POSIX
  9979.  
  9980. 
  9981. File: libc.info,  Node: __dpmi_get_memory_information,  Next: __dpmi_get_multiple_descriptors,  Prev: __dpmi_get_memory_block_size_and_base,  Up: Alphabetical List
  9982.  
  9983. __dpmi_get_memory_information
  9984. =============================
  9985.  
  9986. Syntax
  9987. ------
  9988.  
  9989.      #include <dpmi.h>
  9990.      
  9991.      int __dpmi_get_memory_information(__dpmi_memory_info *buffer);
  9992.  
  9993. Description
  9994. -----------
  9995.  
  9996. Please refer to *Note DPMI Specification:: for details on DPMI function
  9997. call operation.  Also see *Note DPMI Overview:: for general information.
  9998.  
  9999. DPMI function AX = 0x050b (DPMI 1.0 only).  Not supported by CWSDPMI and
  10000. Windows.
  10001.  
  10002. This function returns virtual memory information, as follows:
  10003.  
  10004. `total_allocated_bytes_of_physical_memory_host'
  10005.      The total amount of allocated physical memory controlled by the
  10006.      DPMI host.
  10007.  
  10008. `total_allocated_bytes_of_virtual_memory_host'
  10009.      The total amount of allocated virtual memory controlled by the DPMI
  10010.      host.
  10011.  
  10012. `total_available_bytes_of_virtual_memory_host'
  10013.      The total amount of available virtual memory controlled by the DPMI
  10014.      host.
  10015.  
  10016. `total_allocated_bytes_of_virtual_memory_vcpu'
  10017.      The amount of virtual memory allocated by the DPMI host for the
  10018.      current virtual machine.
  10019.  
  10020. `total_available_bytes_of_virtual_memory_vcpu'
  10021.      The amount of virtual memory available for the current virtual
  10022.      machine.
  10023.  
  10024. `total_allocated_bytes_of_virtual_memory_client'
  10025.      The amount of virtual memory allocated by the DPMI host for the
  10026.      current client (that is, for the calling program).
  10027.  
  10028. `total_available_bytes_of_virtual_memory_client'
  10029.      The amount of virtual memory available to the current client.
  10030.  
  10031. `total_locked_bytes_of_memory_client'
  10032.      The amount of memory locked by the calling program.
  10033.  
  10034. `max_locked_bytes_of_memory_client'
  10035.      Maximum locked memory for the current client.
  10036.  
  10037. `highest_linear_address_available_to_client'
  10038.      The highest linear address available to the calling program.
  10039.  
  10040. `size_in_bytes_of_largest_free_memory_block'
  10041.      Size of the largest available memory block.
  10042.  
  10043. `size_of_minimum_allocation_unit_in_bytes'
  10044.      Size of the smallest block that can be allocated.
  10045.  
  10046. `size_of_allocation_alignment_unit_in_bytes'
  10047.      The alignment of allocated memory blocks.
  10048.  
  10049. Return Value
  10050. ------------
  10051.  
  10052. -1 on error, else zero.
  10053.  
  10054. Portability
  10055. -----------
  10056.  
  10057. not ANSI, not POSIX
  10058.  
  10059. 
  10060. File: libc.info,  Node: __dpmi_get_multiple_descriptors,  Next: __dpmi_get_page_attributes,  Prev: __dpmi_get_memory_information,  Up: Alphabetical List
  10061.  
  10062. __dpmi_get_multiple_descriptors
  10063. ===============================
  10064.  
  10065. Syntax
  10066. ------
  10067.  
  10068.      #include <dpmi.h>
  10069.      
  10070.      int __dpmi_get_multiple_descriptors(int count, void *buffer);
  10071.  
  10072. Description
  10073. -----------
  10074.  
  10075. Please refer to *Note DPMI Specification:: for details on DPMI function
  10076. call operation.  Also see *Note DPMI Overview:: for general information.
  10077.  
  10078. DPMI function AX = 0x000e (DPMI 1.0 only).  Not supported by CWSDPMI and
  10079. Windows.
  10080.  
  10081. This function gets a list of selectors' parameters.  The buffer pointed
  10082. to by BUFFER must be prefilled with selector values, and will contain
  10083. the parameters on return:
  10084.  
  10085.      [0x00:2] selector #1 (pass)
  10086.      [0x02:8] parameters #1 (returned)
  10087.      [0x0a:2] selector #2 (pass)
  10088.      [0x0c:8] parameters #2 (returned)
  10089.      ...
  10090.  
  10091. Return Value
  10092. ------------
  10093.  
  10094. Returns COUNT if successful, the negative of the number of descriptors
  10095. copied if failure.
  10096.  
  10097. Portability
  10098. -----------
  10099.  
  10100. not ANSI, not POSIX
  10101.  
  10102. 
  10103. File: libc.info,  Node: __dpmi_get_page_attributes,  Next: __dpmi_get_page_size,  Prev: __dpmi_get_multiple_descriptors,  Up: Alphabetical List
  10104.  
  10105. __dpmi_get_page_attributes
  10106. ==========================
  10107.  
  10108. Syntax
  10109. ------
  10110.  
  10111.      #include <dpmi.h>
  10112.      
  10113.      int __dpmi_get_page_attributes(__dpmi_meminfo *info, short *buffer);
  10114.  
  10115. Description
  10116. -----------
  10117.  
  10118. Please refer to *Note DPMI Specification:: for details on DPMI function
  10119. call operation.  Also see *Note DPMI Overview:: for general information.
  10120.  
  10121. DPMI function AX = 0x0506 (DPMI 1.0 only).  Supported by CWSDPMI, but
  10122. not by Windows.
  10123.  
  10124. This function retrieves the attributes of a number of pages.  Pass the
  10125. handle in `INFO->handle', offset of first page (relative to start of
  10126. block) in `INFO->address', and number of pages in `INFO->count'.  The
  10127. buffer BUFFER gets filled in with the attributes.  For each page, a
  10128. 16-bit attribute word in BUFFER defines the attributes of that page as
  10129. follows:
  10130.  
  10131. bits 0-2
  10132.      Page type:
  10133.  
  10134.     `000'
  10135.           uncommitted
  10136.  
  10137.     `001'
  10138.           committed
  10139.  
  10140.     `010'
  10141.           mapped
  10142.  
  10143. bit 3
  10144.      If set, the page is read/write.  If cleared, the page is read-only.
  10145.  
  10146. bit 4
  10147.      If set, bits 5 and 6 specify accessed and dirty bits.
  10148.  
  10149. bit 5
  10150.      The page has been accessed (only valid if bit 4 is set).
  10151.  
  10152. bit 6
  10153.      The page has been written (is "dirty").  Only valid if bit 4 is
  10154.      set.
  10155.  
  10156. Return Value
  10157. ------------
  10158.  
  10159. -1 on error, else zero.
  10160.  
  10161. Portability
  10162. -----------
  10163.  
  10164. not ANSI, not POSIX
  10165.  
  10166. 
  10167. File: libc.info,  Node: __dpmi_get_page_size,  Next: __dpmi_get_processor_exception_handler_vector,  Prev: __dpmi_get_page_attributes,  Up: Alphabetical List
  10168.  
  10169. __dpmi_get_page_size
  10170. ====================
  10171.  
  10172. Syntax
  10173. ------
  10174.  
  10175.      #include <dpmi.h>
  10176.      
  10177.      int __dpmi_get_page_size(unsigned long *_size);
  10178.  
  10179. Description
  10180. -----------
  10181.  
  10182. Please refer to *Note DPMI Specification:: for details on DPMI function
  10183. call operation.  Also see *Note DPMI Overview:: for general information.
  10184.  
  10185. DPMI function AX = 0x0604
  10186.  
  10187. Fills in the page size.
  10188.  
  10189. Return Value
  10190. ------------
  10191.  
  10192. -1 on error (16-bit host), else zero.
  10193.  
  10194. Portability
  10195. -----------
  10196.  
  10197. not ANSI, not POSIX
  10198.  
  10199. 
  10200. File: libc.info,  Node: __dpmi_get_processor_exception_handler_vector,  Next: __dpmi_get_protected_mode_interrupt_vector,  Prev: __dpmi_get_page_size,  Up: Alphabetical List
  10201.  
  10202. __dpmi_get_processor_exception_handler_vector
  10203. =============================================
  10204.  
  10205. Syntax
  10206. ------
  10207.  
  10208.      #include <dpmi.h>
  10209.      
  10210.      int __dpmi_get_processor_exception_handler_vector(int _vector, __dpmi_paddr *_address);
  10211.  
  10212. Description
  10213. -----------
  10214.  
  10215. Please refer to *Note DPMI Specification:: for details on DPMI function
  10216. call operation.  Also see *Note DPMI Overview:: for general information.
  10217.  
  10218. DPMI function AX = 0x0202
  10219.  
  10220. This function gets the current protected-mode exception handler (not
  10221. interrupts) for the exception _VECTOR.  It will return a
  10222. selector:offset pair in the members of the _ADDRESS variable.
  10223.  
  10224. Return Value
  10225. ------------
  10226.  
  10227. -1 on error (invalid vector), else zero.
  10228.  
  10229. Portability
  10230. -----------
  10231.  
  10232. not ANSI, not POSIX
  10233.  
  10234. 
  10235. File: libc.info,  Node: __dpmi_get_protected_mode_interrupt_vector,  Next: __dpmi_get_raw_mode_switch_addr,  Prev: __dpmi_get_processor_exception_handler_vector,  Up: Alphabetical List
  10236.  
  10237. __dpmi_get_protected_mode_interrupt_vector
  10238. ==========================================
  10239.  
  10240. Syntax
  10241. ------
  10242.  
  10243.      #include <dpmi.h>
  10244.      
  10245.      int __dpmi_get_protected_mode_interrupt_vector(int _vector, __dpmi_paddr *_address);
  10246.  
  10247. Description
  10248. -----------
  10249.  
  10250. Please refer to *Note DPMI Specification:: for details on DPMI function
  10251. call operation.  Also see *Note DPMI Overview:: for general information.
  10252.  
  10253. DPMI function AX = 0x0204
  10254.  
  10255. This function gets the address of the current protected mode interrupt
  10256. (not exception) handler.  It returns a selector:offset pair.
  10257.  
  10258. Return Value
  10259. ------------
  10260.  
  10261. Zero.  This always works.
  10262.  
  10263. Portability
  10264. -----------
  10265.  
  10266. not ANSI, not POSIX
  10267.  
  10268. 
  10269. File: libc.info,  Node: __dpmi_get_raw_mode_switch_addr,  Next: __dpmi_get_real_mode_interrupt_vector,  Prev: __dpmi_get_protected_mode_interrupt_vector,  Up: Alphabetical List
  10270.  
  10271. __dpmi_get_raw_mode_switch_addr
  10272. ===============================
  10273.  
  10274. Syntax
  10275. ------
  10276.  
  10277.      #include <dpmi.h>
  10278.      
  10279.      int __dpmi_get_raw_mode_switch_addr(__dpmi_raddr *_rm, __dpmi_paddr *_pm);
  10280.  
  10281. Description
  10282. -----------
  10283.  
  10284. Please refer to *Note DPMI Specification:: for details on DPMI function
  10285. call operation.  Also see *Note DPMI Overview:: for general information.
  10286.  
  10287. DPMI function AX = 0x0306
  10288.  
  10289. Read the spec for more info.
  10290.  
  10291. Return Value
  10292. ------------
  10293.  
  10294. Zero.  This always works.
  10295.  
  10296. Portability
  10297. -----------
  10298.  
  10299. not ANSI, not POSIX
  10300.  
  10301. 
  10302. File: libc.info,  Node: __dpmi_get_real_mode_interrupt_vector,  Next: __dpmi_get_segment_base_address,  Prev: __dpmi_get_raw_mode_switch_addr,  Up: Alphabetical List
  10303.  
  10304. __dpmi_get_real_mode_interrupt_vector
  10305. =====================================
  10306.  
  10307. Syntax
  10308. ------
  10309.  
  10310.      #include <dpmi.h>
  10311.      
  10312.      int __dpmi_get_real_mode_interrupt_vector(int _vector, __dpmi_raddr *_address);
  10313.  
  10314. Description
  10315. -----------
  10316.  
  10317. Please refer to *Note DPMI Specification:: for details on DPMI function
  10318. call operation.  Also see *Note DPMI Overview:: for general information.
  10319.  
  10320. DPMI function AX = 0x0200
  10321.  
  10322. This function stores the real-mode interrupt vector address in
  10323. _ADDRESS. This is the same as the DOS get vector call, and returns a
  10324. real-mode segment:offset pair.
  10325.  
  10326. Bits [31:8] in the vector number are silently ignored.
  10327.  
  10328. Return Value
  10329. ------------
  10330.  
  10331. Zero.  This function always works.
  10332.  
  10333. Portability
  10334. -----------
  10335.  
  10336. not ANSI, not POSIX
  10337.  
  10338. 
  10339. File: libc.info,  Node: __dpmi_get_segment_base_address,  Next: __dpmi_get_segment_limit,  Prev: __dpmi_get_real_mode_interrupt_vector,  Up: Alphabetical List
  10340.  
  10341. __dpmi_get_segment_base_address
  10342. ===============================
  10343.  
  10344. Syntax
  10345. ------
  10346.  
  10347.      #include <dpmi.h>
  10348.      
  10349.      int __dpmi_get_segment_base_address(int _selector, unsigned long *_addr);
  10350.  
  10351. Description
  10352. -----------
  10353.  
  10354. Please refer to *Note DPMI Specification:: for details on DPMI function
  10355. call operation.  Also see *Note DPMI Overview:: for general information.
  10356.  
  10357. DPMI function AX = 0x0006
  10358.  
  10359. The physical base address of the selector is stored in *ADDR.
  10360.  
  10361. Return Value
  10362. ------------
  10363.  
  10364. -1 on error, else zero.
  10365.  
  10366. Portability
  10367. -----------
  10368.  
  10369. not ANSI, not POSIX
  10370.  
  10371. Example
  10372. -------
  10373.  
  10374.      unsigned long addr;
  10375.      if (__dpmi_get_segment_base_address(selector, &addr))
  10376.        ...
  10377.  
  10378. 
  10379. File: libc.info,  Node: __dpmi_get_segment_limit,  Next: __dpmi_get_selector_increment_value,  Prev: __dpmi_get_segment_base_address,  Up: Alphabetical List
  10380.  
  10381. __dpmi_get_segment_limit
  10382. ========================
  10383.  
  10384. Syntax
  10385. ------
  10386.  
  10387.      #include <dpmi.h>
  10388.      
  10389.      unsigned __dpmi_get_segment_limit(int _selector);
  10390.  
  10391. Description
  10392. -----------
  10393.  
  10394. Please refer to *Note DPMI Specification:: for details on DPMI function
  10395. call operation.  Also see *Note DPMI Overview:: for general information.
  10396.  
  10397. Return Value
  10398. ------------
  10399.  
  10400. The limit of the segment, as returned by the `lsl' opcode.
  10401.  
  10402. Portability
  10403. -----------
  10404.  
  10405. not ANSI, not POSIX
  10406.  
  10407. 
  10408. File: libc.info,  Node: __dpmi_get_selector_increment_value,  Next: __dpmi_get_state_of_debug_watchpoint,  Prev: __dpmi_get_segment_limit,  Up: Alphabetical List
  10409.  
  10410. __dpmi_get_selector_increment_value
  10411. ===================================
  10412.  
  10413. Syntax
  10414. ------
  10415.  
  10416.      #include <dpmi.h>
  10417.      
  10418.      int __dpmi_get_selector_increment_value(void);
  10419.  
  10420. Description
  10421. -----------
  10422.  
  10423. Please refer to *Note DPMI Specification:: for details on DPMI function
  10424. call operation.  Also see *Note DPMI Overview:: for general information.
  10425.  
  10426. DPMI function AX = 0x0003
  10427.  
  10428. Return Value
  10429. ------------
  10430.  
  10431. The value to add to each selector allocated by
  10432. __dpmi_allocate_ldt_descriptors to get the next one.
  10433.  
  10434. Portability
  10435. -----------
  10436.  
  10437. not ANSI, not POSIX
  10438.  
  10439. 
  10440. File: libc.info,  Node: __dpmi_get_state_of_debug_watchpoint,  Next: __dpmi_get_state_save_restore_addr,  Prev: __dpmi_get_selector_increment_value,  Up: Alphabetical List
  10441.  
  10442. __dpmi_get_state_of_debug_watchpoint
  10443. ====================================
  10444.  
  10445. Syntax
  10446. ------
  10447.  
  10448.      #include <dpmi.h>
  10449.      
  10450.      int __dpmi_get_state_of_debug_watchpoint(unsigned long _handle, int *_status);
  10451.  
  10452. Description
  10453. -----------
  10454.  
  10455. Please refer to *Note DPMI Specification:: for details on DPMI function
  10456. call operation.  Also see *Note DPMI Overview:: for general information.
  10457.  
  10458. DPMI function AX = 0x0b02
  10459.  
  10460. Gets the state of the watchpoint.  Pass handle, fills in status (0=not
  10461. encountered, 1=encountered).
  10462.  
  10463. Return Value
  10464. ------------
  10465.  
  10466. -1 on error, else zero.
  10467.  
  10468. Portability
  10469. -----------
  10470.  
  10471. not ANSI, not POSIX
  10472.  
  10473. 
  10474. File: libc.info,  Node: __dpmi_get_state_save_restore_addr,  Next: __dpmi_get_vendor_specific_api_entry_point,  Prev: __dpmi_get_state_of_debug_watchpoint,  Up: Alphabetical List
  10475.  
  10476. __dpmi_get_state_save_restore_addr
  10477. ==================================
  10478.  
  10479. Syntax
  10480. ------
  10481.  
  10482.      #include <dpmi.h>
  10483.      
  10484.      int __dpmi_get_state_save_restore_addr(__dpmi_raddr *_rm, __dpmi_paddr *_pm);
  10485.  
  10486. Description
  10487. -----------
  10488.  
  10489. Please refer to *Note DPMI Specification:: for details on DPMI function
  10490. call operation.  Also see *Note DPMI Overview:: for general information.
  10491.  
  10492. DPMI function AX = 0x0305
  10493.  
  10494. Read the spec for info.
  10495.  
  10496. Return Value
  10497. ------------
  10498.  
  10499. The number of bytes required to save state.
  10500.  
  10501. Portability
  10502. -----------
  10503.  
  10504. not ANSI, not POSIX
  10505.  
  10506. 
  10507. File: libc.info,  Node: __dpmi_get_vendor_specific_api_entry_point,  Next: __dpmi_get_version,  Prev: __dpmi_get_state_save_restore_addr,  Up: Alphabetical List
  10508.  
  10509. __dpmi_get_vendor_specific_api_entry_point
  10510. ==========================================
  10511.  
  10512. Syntax
  10513. ------
  10514.  
  10515.      #include <dpmi.h>
  10516.      
  10517.      int __dpmi_get_vendor_specific_api_entry_point(char *_id, __dpmi_paddr *_api);
  10518.  
  10519. Description
  10520. -----------
  10521.  
  10522. Please refer to *Note DPMI Specification:: for details on DPMI function
  10523. call operation.  Also see *Note DPMI Overview:: for general information.
  10524.  
  10525. DPMI function AX = 0x0a00
  10526.  
  10527. Look up a vendor-specific function, given the *name* of the function.
  10528.  
  10529. Return Value
  10530. ------------
  10531.  
  10532. -1 on error, else zero.
  10533.  
  10534. Portability
  10535. -----------
  10536.  
  10537. not ANSI, not POSIX
  10538.  
  10539. 
  10540. File: libc.info,  Node: __dpmi_get_version,  Next: __dpmi_get_virtual_interrupt_state,  Prev: __dpmi_get_vendor_specific_api_entry_point,  Up: Alphabetical List
  10541.  
  10542. __dpmi_get_version
  10543. ==================
  10544.  
  10545. Syntax
  10546. ------
  10547.  
  10548.      #include <dpmi.h>
  10549.      
  10550.      int __dpmi_get_version(__dpmi_version_ret *_ret);
  10551.  
  10552. Description
  10553. -----------
  10554.  
  10555. Please refer to *Note DPMI Specification:: for details on DPMI function
  10556. call operation.  Also see *Note DPMI Overview:: for general information.
  10557.  
  10558. DPMI function AX = 0x0400
  10559.  
  10560. Fills in version information.  The flags are as follows:
  10561.  
  10562.      ---- ---X = 0=16-bit host  1=32-bit host
  10563.      ---- --X- = 0=V86 used for reflected ints, 1=real mode
  10564.      ---- -X-- = 0=no virtual memory, 1=virtual memory supported
  10565.  
  10566. The cpu is 2=80286, 3=80386, 4=80486, etc.
  10567.  
  10568. DPMI 0.9 returns major=0 and minor=0x5a.
  10569.  
  10570. Return Value
  10571. ------------
  10572.  
  10573. Zero.  This always works.
  10574.  
  10575. Portability
  10576. -----------
  10577.  
  10578. not ANSI, not POSIX
  10579.  
  10580. 
  10581. File: libc.info,  Node: __dpmi_get_virtual_interrupt_state,  Next: __dpmi_install_resident_service_provider_callback,  Prev: __dpmi_get_version,  Up: Alphabetical List
  10582.  
  10583. __dpmi_get_virtual_interrupt_state
  10584. ==================================
  10585.  
  10586. Syntax
  10587. ------
  10588.  
  10589.      #include <dpmi.h>
  10590.      
  10591.      int __dpmi_get_virtual_interrupt_state(void);
  10592.  
  10593. Description
  10594. -----------
  10595.  
  10596. Please refer to *Note DPMI Specification:: for details on DPMI function
  10597. call operation.  Also see *Note DPMI Overview:: for general information.
  10598.  
  10599. DPMI function AX = 0x0902
  10600.  
  10601. Return Value
  10602. ------------
  10603.  
  10604. This function returns the current interrupt flag (1=enabled).
  10605.  
  10606. Portability
  10607. -----------
  10608.  
  10609. not ANSI, not POSIX
  10610.  
  10611. 
  10612. File: libc.info,  Node: __dpmi_install_resident_service_provider_callback,  Next: __dpmi_int,  Prev: __dpmi_get_virtual_interrupt_state,  Up: Alphabetical List
  10613.  
  10614. __dpmi_install_resident_service_provider_callback
  10615. =================================================
  10616.  
  10617. Syntax
  10618. ------
  10619.  
  10620.      #include <dpmi.h>
  10621.      
  10622.      int
  10623.      __dpmi_install_resident_service_provider_callback(__dpmi_callback_info *info);
  10624.  
  10625. Description
  10626. -----------
  10627.  
  10628. Please refer to *Note DPMI Specification:: for details on DPMI function
  10629. call operation.  Also see *Note DPMI Overview:: for general information.
  10630.  
  10631. DPMI function AX = 0x0c00 (DPMI 1.0 only).  Not supported by CWSDPMI and
  10632. Windows.
  10633.  
  10634. This function installs a resident service provider callback and declares
  10635. an intent to provide resident protected-mode services after terminating
  10636. with a call to `__dpmi_terminate_and_stay_resident' (*note
  10637. __dpmi_terminate_and_stay_resident::.).
  10638.  
  10639. The various members of INFO should be filled as follows:
  10640.  
  10641. `data16'
  10642.      An 8-byte descriptor for the 16-bit data segment.
  10643.  
  10644. `code16'
  10645.      An 8-byte descriptor for the 16-bit code segment (zeros if not
  10646.      supported).
  10647.  
  10648. `ip'
  10649.      A 16-bit offset of the 16-bit callback procedure.
  10650.  
  10651. `data32'
  10652.      An 8-byte descriptor for 32-bit data segment.
  10653.  
  10654. `code32'
  10655.      An 8-byte descriptor for 32-bit code segment (zeros if not
  10656.      supported).
  10657.  
  10658. `eip'
  10659.      A 32-bit offset of the 32-bit callback procedure.
  10660.  
  10661. *Note __dpmi_get_descriptor::, for the details about the layout of the
  10662. 8-byte segment descriptor.
  10663.  
  10664. Return Value
  10665. ------------
  10666.  
  10667. -1 on error, else zero.
  10668.  
  10669. Portability
  10670. -----------
  10671.  
  10672. not ANSI, not POSIX
  10673.  
  10674. 
  10675. File: libc.info,  Node: __dpmi_int,  Next: __dpmi_lock_linear_region,  Prev: __dpmi_install_resident_service_provider_callback,  Up: Alphabetical List
  10676.  
  10677. __dpmi_int
  10678. ==========
  10679.  
  10680. Syntax
  10681. ------
  10682.  
  10683.      #include <dpmi.h>
  10684.      
  10685.      int __dpmi_int(int _vector, __dpmi_regs *_regs);
  10686.  
  10687. Description
  10688. -----------
  10689.  
  10690. Please refer to *Note DPMI Specification:: for details on DPMI function
  10691. call operation.  Also see *Note DPMI Overview:: for general information.
  10692.  
  10693. DPMI function AX = 0x0300
  10694.  
  10695. This function performs a software interrupt in real mode after filling
  10696. in *most* the registers from the given structure.  %ss, %esp, and
  10697. %eflags are automatically taken care of, unlike *Note
  10698. __dpmi_simulate_real_mode_interrupt::.
  10699.  
  10700. The following variables can be used to tune this function.  By default,
  10701. these variables are all zero.
  10702.  
  10703. `__dpmi_int_ss'
  10704. `__dpmi_int_sp'
  10705. `__dpmi_int_flags'
  10706.      These hold the values stored in the appropriate field in the
  10707.      `__dpmi_regs' structure.
  10708.  
  10709. Return Value
  10710. ------------
  10711.  
  10712. -1 on error, else zero.
  10713.  
  10714. Portability
  10715. -----------
  10716.  
  10717. not ANSI, not POSIX
  10718.  
  10719. 
  10720. File: libc.info,  Node: __dpmi_lock_linear_region,  Next: __dpmi_map_conventional_memory_in_memory_block,  Prev: __dpmi_int,  Up: Alphabetical List
  10721.  
  10722. __dpmi_lock_linear_region
  10723. =========================
  10724.  
  10725. Syntax
  10726. ------
  10727.  
  10728.      #include <dpmi.h>
  10729.      
  10730.      int __dpmi_lock_linear_region(__dpmi_meminfo *_info);
  10731.  
  10732. Description
  10733. -----------
  10734.  
  10735. Please refer to *Note DPMI Specification:: for details on DPMI function
  10736. call operation.  Also see *Note DPMI Overview:: for general information.
  10737.  
  10738. DPMI function AX = 0x0600
  10739.  
  10740. This function locks virtual memory, to prevent page faults during
  10741. hardware interrupts.  Pass address and size (in bytes).
  10742.  
  10743. Return Value
  10744. ------------
  10745.  
  10746. -1 on error, else zero.
  10747.  
  10748. Portability
  10749. -----------
  10750.  
  10751. not ANSI, not POSIX
  10752.  
  10753. 
  10754. File: libc.info,  Node: __dpmi_map_conventional_memory_in_memory_block,  Next: __dpmi_map_device_in_memory_block,  Prev: __dpmi_lock_linear_region,  Up: Alphabetical List
  10755.  
  10756. __dpmi_map_conventional_memory_in_memory_block
  10757. ==============================================
  10758.  
  10759. Syntax
  10760. ------
  10761.  
  10762.      #include <dpmi.h>
  10763.      
  10764.      int __dpmi_map_conventional_memory_in_memory_block(__dpmi_meminfo *info,
  10765.                                                         unsigned long physaddr);
  10766.  
  10767. Description
  10768. -----------
  10769.  
  10770. Please refer to *Note DPMI Specification:: for details on DPMI function
  10771. call operation.  Also see *Note DPMI Overview:: for general information.
  10772.  
  10773. DPMI function AX = 0x0509 (DPMI 1.0 only).  Supported by CWSDPMI, but
  10774. not by Windows.
  10775.  
  10776. This function maps conventional memory (even when virtualized) to
  10777. virtual memory.  Pass the handle, offset, and number of pages.
  10778.  
  10779. Return Value
  10780. ------------
  10781.  
  10782. -1 on error, else zero.
  10783.  
  10784. Portability
  10785. -----------
  10786.  
  10787. not ANSI, not POSIX
  10788.  
  10789. 
  10790. File: libc.info,  Node: __dpmi_map_device_in_memory_block,  Next: __dpmi_mark_page_as_demand_paging_candidate,  Prev: __dpmi_map_conventional_memory_in_memory_block,  Up: Alphabetical List
  10791.  
  10792. __dpmi_map_device_in_memory_block
  10793. =================================
  10794.  
  10795. Syntax
  10796. ------
  10797.  
  10798.      #include <dpmi.h>
  10799.      
  10800.      int __dpmi_map_device_in_memory_block(__dpmi_meminfo *info,
  10801.                                            unsigned long *physaddr);
  10802.  
  10803. Description
  10804. -----------
  10805.  
  10806. Please refer to *Note DPMI Specification:: for details on DPMI function
  10807. call operation.  Also see *Note DPMI Overview:: for general information.
  10808.  
  10809. DPMI function AX = 0x0508 (DPMI 1.0 only).  Supported by CWSDPMI, but
  10810. not by Windows.
  10811.  
  10812. This function maps a physical address range to virtual memory.  Pass
  10813. the handle, offset relative to the start of the block, and number of
  10814. pages to map.
  10815.  
  10816. Return Value
  10817. ------------
  10818.  
  10819. -1 on error, else zero.
  10820.  
  10821. Portability
  10822. -----------
  10823.  
  10824. not ANSI, not POSIX
  10825.  
  10826. 
  10827. File: libc.info,  Node: __dpmi_mark_page_as_demand_paging_candidate,  Next: __dpmi_mark_real_mode_region_as_pageable,  Prev: __dpmi_map_device_in_memory_block,  Up: Alphabetical List
  10828.  
  10829. __dpmi_mark_page_as_demand_paging_candidate
  10830. ===========================================
  10831.  
  10832. Syntax
  10833. ------
  10834.  
  10835.      #include <dpmi.h>
  10836.      
  10837.      int __dpmi_mark_page_as_demand_paging_candidate(__dpmi_meminfo *_info);
  10838.  
  10839. Description
  10840. -----------
  10841.  
  10842. Please refer to *Note DPMI Specification:: for details on DPMI function
  10843. call operation.  Also see *Note DPMI Overview:: for general information.
  10844.  
  10845. DPMI function AX = 0x0702
  10846.  
  10847. Advises the server that certain pages are unlikely to be used soon.
  10848. Set address and size (in bytes).
  10849.  
  10850. Return Value
  10851. ------------
  10852.  
  10853. -1 on error, else zero.
  10854.  
  10855. Portability
  10856. -----------
  10857.  
  10858. not ANSI, not POSIX
  10859.  
  10860. 
  10861. File: libc.info,  Node: __dpmi_mark_real_mode_region_as_pageable,  Next: __dpmi_physical_address_mapping,  Prev: __dpmi_mark_page_as_demand_paging_candidate,  Up: Alphabetical List
  10862.  
  10863. __dpmi_mark_real_mode_region_as_pageable
  10864. ========================================
  10865.  
  10866. Syntax
  10867. ------
  10868.  
  10869.      #include <dpmi.h>
  10870.      
  10871.      int __dpmi_mark_real_mode_region_as_pageable(__dpmi_meminfo *_info);
  10872.  
  10873. Description
  10874. -----------
  10875.  
  10876. Please refer to *Note DPMI Specification:: for details on DPMI function
  10877. call operation.  Also see *Note DPMI Overview:: for general information.
  10878.  
  10879. DPMI function AX = 0x0602
  10880.  
  10881. This function advises the host that the given pages are suitable for
  10882. page-out.  Pass address and size (in bytes).
  10883.  
  10884. Return Value
  10885. ------------
  10886.  
  10887. -1 on error, else zero.
  10888.  
  10889. Portability
  10890. -----------
  10891.  
  10892. not ANSI, not POSIX
  10893.  
  10894. 
  10895. File: libc.info,  Node: __dpmi_physical_address_mapping,  Next: __dpmi_relock_real_mode_region,  Prev: __dpmi_mark_real_mode_region_as_pageable,  Up: Alphabetical List
  10896.  
  10897. __dpmi_physical_address_mapping
  10898. ===============================
  10899.  
  10900. Syntax
  10901. ------
  10902.  
  10903.      #include <dpmi.h>
  10904.      
  10905.      int __dpmi_physical_address_mapping(__dpmi_meminfo *_info);
  10906.  
  10907. Description
  10908. -----------
  10909.  
  10910. Please refer to *Note DPMI Specification:: for details on DPMI function
  10911. call operation.  Also see *Note DPMI Overview:: for general information.
  10912.  
  10913. DPMI function AX = 0x0800
  10914.  
  10915. Maps a physical device (like a graphics buffer) to linear memory.  Fill
  10916. in the physical address and size (in bytes).  On return, the address is
  10917. the linear address to use.
  10918.  
  10919. Return Value
  10920. ------------
  10921.  
  10922. -1 on error, else zero.
  10923.  
  10924. Portability
  10925. -----------
  10926.  
  10927. not ANSI, not POSIX
  10928.  
  10929. 
  10930. File: libc.info,  Node: __dpmi_relock_real_mode_region,  Next: __dpmi_reset_debug_watchpoint,  Prev: __dpmi_physical_address_mapping,  Up: Alphabetical List
  10931.  
  10932. __dpmi_relock_real_mode_region
  10933. ==============================
  10934.  
  10935. Syntax
  10936. ------
  10937.  
  10938.      #include <dpmi.h>
  10939.      
  10940.      int __dpmi_relock_real_mode_region(__dpmi_meminfo *_info);
  10941.  
  10942. Description
  10943. -----------
  10944.  
  10945. Please refer to *Note DPMI Specification:: for details on DPMI function
  10946. call operation.  Also see *Note DPMI Overview:: for general information.
  10947.  
  10948. DPMI function AX = 0x0603
  10949.  
  10950. This function relocks the pages unlocked with *Note
  10951. __dpmi_mark_real_mode_region_as_pageable::.  Pass address and size (in
  10952. bytes).
  10953.  
  10954. Return Value
  10955. ------------
  10956.  
  10957. -1 on error, else zero.
  10958.  
  10959. Portability
  10960. -----------
  10961.  
  10962. not ANSI, not POSIX
  10963.  
  10964. 
  10965. File: libc.info,  Node: __dpmi_reset_debug_watchpoint,  Next: __dpmi_resize_dos_memory,  Prev: __dpmi_relock_real_mode_region,  Up: Alphabetical List
  10966.  
  10967. __dpmi_reset_debug_watchpoint
  10968. =============================
  10969.  
  10970. Syntax
  10971. ------
  10972.  
  10973.      #include <dpmi.h>
  10974.      
  10975.      int __dpmi_reset_debug_watchpoint(unsigned long _handle);
  10976.  
  10977. Description
  10978. -----------
  10979.  
  10980. Please refer to *Note DPMI Specification:: for details on DPMI function
  10981. call operation.  Also see *Note DPMI Overview:: for general information.
  10982.  
  10983. DPMI function AX = 0x0b03
  10984.  
  10985. Resets a watchpoint given its handle in _HANDLE.
  10986.  
  10987. Return Value
  10988. ------------
  10989.  
  10990. -1 on error, else zero.
  10991.  
  10992. Portability
  10993. -----------
  10994.  
  10995. not ANSI, not POSIX
  10996.  
  10997. 
  10998. File: libc.info,  Node: __dpmi_resize_dos_memory,  Next: __dpmi_resize_linear_memory,  Prev: __dpmi_reset_debug_watchpoint,  Up: Alphabetical List
  10999.  
  11000. __dpmi_resize_dos_memory
  11001. ========================
  11002.  
  11003. Syntax
  11004. ------
  11005.  
  11006.      #include <dpmi.h>
  11007.      
  11008.      int __dpmi_resize_dos_memory(int _selector, int _newpara, int *_ret_max);
  11009.  
  11010. Description
  11011. -----------
  11012.  
  11013. Please refer to *Note DPMI Specification:: for details on DPMI function
  11014. call operation.  Also see *Note DPMI Overview:: for general information.
  11015.  
  11016. DPMI function AX = 0x0102
  11017.  
  11018. This function resizes a dos memory block.  Remember to pass the
  11019. selector, and not the segment.  If this call fails, _RET_MAX contains
  11020. the largest number of paragraphs available.
  11021.  
  11022. Return Value
  11023. ------------
  11024.  
  11025. -1 on error, else zero.
  11026.  
  11027. Portability
  11028. -----------
  11029.  
  11030. not ANSI, not POSIX
  11031.  
  11032. 
  11033. File: libc.info,  Node: __dpmi_resize_linear_memory,  Next: __dpmi_resize_memory,  Prev: __dpmi_resize_dos_memory,  Up: Alphabetical List
  11034.  
  11035. __dpmi_resize_linear_memory
  11036. ===========================
  11037.  
  11038. Syntax
  11039. ------
  11040.  
  11041.      #include <dpmi.h>
  11042.      
  11043.      int __dpmi_resize_linear_memory(__dpmi_meminfo *info, int commit);
  11044.  
  11045. Description
  11046. -----------
  11047.  
  11048. Please refer to *Note DPMI Specification:: for details on DPMI function
  11049. call operation.  Also see *Note DPMI Overview:: for general information.
  11050.  
  11051. DPMI function AX = 0x0505 (DPMI 1.0 only).  Not supported by CWSDPMI and
  11052. Windows.
  11053.  
  11054. This function resizes a memory block.  Pass the handle and new size.
  11055. Bit 0 of COMMIT is 1 for committed pages; bit 1 is 1 to automatically
  11056. update descriptors.  It returns a new handle and base address.
  11057.  
  11058. Return Value
  11059. ------------
  11060.  
  11061. -1 on error, else zero.
  11062.  
  11063. Portability
  11064. -----------
  11065.  
  11066. not ANSI, not POSIX
  11067.  
  11068. 
  11069. File: libc.info,  Node: __dpmi_resize_memory,  Next: __dpmi_segment_to_descriptor,  Prev: __dpmi_resize_linear_memory,  Up: Alphabetical List
  11070.  
  11071. __dpmi_resize_memory
  11072. ====================
  11073.  
  11074. Syntax
  11075. ------
  11076.  
  11077.      #include <dpmi.h>
  11078.      
  11079.      int __dpmi_resize_memory(__dpmi_meminfo *_info);
  11080.  
  11081. Description
  11082. -----------
  11083.  
  11084. Please refer to *Note DPMI Specification:: for details on DPMI function
  11085. call operation.  Also see *Note DPMI Overview:: for general information.
  11086.  
  11087. DPMI function AX = 0x0503
  11088.  
  11089. This function changes the size of a virtual memory block.  You must
  11090. pass the handle and size fields.  It may change the base address also;
  11091. beware of debugging breakpoints and locked memory.  It will return a
  11092. new handle.
  11093.  
  11094. Return Value
  11095. ------------
  11096.  
  11097. -1 on error, else zero.
  11098.  
  11099. Portability
  11100. -----------
  11101.  
  11102. not ANSI, not POSIX
  11103.  
  11104. 
  11105. File: libc.info,  Node: __dpmi_segment_to_descriptor,  Next: __dpmi_serialize_on_shared_memory,  Prev: __dpmi_resize_memory,  Up: Alphabetical List
  11106.  
  11107. __dpmi_segment_to_descriptor
  11108. ============================
  11109.  
  11110. Syntax
  11111. ------
  11112.  
  11113.      #include <dpmi.h>
  11114.      
  11115.      int __dpmi_segment_to_descriptor(int _segment);
  11116.  
  11117. Description
  11118. -----------
  11119.  
  11120. Please refer to *Note DPMI Specification:: for details on DPMI function
  11121. call operation.  Also see *Note DPMI Overview:: for general information.
  11122.  
  11123. DPMI function AX = 0x0002
  11124.  
  11125. This function returns a selector that maps to what the real-mode
  11126. segment provided would have referenced.  Warning: this is a scarce
  11127. resource.
  11128.  
  11129. Return Value
  11130. ------------
  11131.  
  11132. -1 on error, else the selector.
  11133.  
  11134. Portability
  11135. -----------
  11136.  
  11137. not ANSI, not POSIX
  11138.  
  11139. Example
  11140. -------
  11141.  
  11142.      short video = __dpmi_segment_to_descriptor(0xa000);
  11143.      movedata(_my_ds(), buffer, video, 0, 320*200);
  11144.  
  11145. 
  11146. File: libc.info,  Node: __dpmi_serialize_on_shared_memory,  Next: __dpmi_set_coprocessor_emulation,  Prev: __dpmi_segment_to_descriptor,  Up: Alphabetical List
  11147.  
  11148. __dpmi_serialize_on_shared_memory
  11149. =================================
  11150.  
  11151. Syntax
  11152. ------
  11153.  
  11154.      #include <dpmi.h>
  11155.      
  11156.      int __dpmi_serialize_on_shared_memory(unsigned long handle, int flags);
  11157.  
  11158. Description
  11159. -----------
  11160.  
  11161. Please refer to *Note DPMI Specification:: for details on DPMI function
  11162. call operation.  Also see *Note DPMI Overview:: for general information.
  11163.  
  11164. DPMI function AX = 0x0d02 (DPMI 1.0 only).  Not supported by CWSDPMI and
  11165. Windows.
  11166.  
  11167. This function serializes access to a shared memory block whose handle is
  11168. given in HANDLE.  The bit-mapped variable FLAGS defines the following
  11169. bits:
  11170.  
  11171. bit 0
  11172.      If set, return immediately if serialization is unavailable.  If
  11173.      cleared, the program is suspended until the serialization becomes
  11174.      available.
  11175.  
  11176. bit 1
  11177.      If set, perform shared serialization.  If cleared, perform
  11178.      exclusive serialization.
  11179.  
  11180. bits 2-15
  11181.      Reserved (should be zero).
  11182.  
  11183. An "exclusive serialization" blocks *any* serialization attempts for
  11184. the same memory block from other virtual machines.  A "shared
  11185. serialization" blocks only *exclusive* serialization attempts from
  11186. other virtual machines.
  11187.  
  11188. Return Value
  11189. ------------
  11190.  
  11191. -1 on error, else zero.
  11192.  
  11193. Portability
  11194. -----------
  11195.  
  11196. not ANSI, not POSIX
  11197.  
  11198. 
  11199. File: libc.info,  Node: __dpmi_set_coprocessor_emulation,  Next: __dpmi_set_debug_watchpoint,  Prev: __dpmi_serialize_on_shared_memory,  Up: Alphabetical List
  11200.  
  11201. __dpmi_set_coprocessor_emulation
  11202. ================================
  11203.  
  11204. Syntax
  11205. ------
  11206.  
  11207.      #include <dpmi.h>
  11208.      
  11209.      int __dpmi_set_coprocessor_emulation(int flags);
  11210.  
  11211. Description
  11212. -----------
  11213.  
  11214. Please refer to *Note DPMI Specification::, for details on DPMI
  11215. function call operation.  Also see *Note DPMI Overview::, for general
  11216. information.
  11217.  
  11218. DPMI function AX = 0x0e01 (DPMI v1.0 only, but supported by most
  11219. DPMI v0.9 servers, including CWSDPMI, Windows, and QDPMI).
  11220.  
  11221. This function sets the co-processor emulation state as specified by
  11222. FLAGS.  The only two used bits in FLAGS are:
  11223.  
  11224. `bit 0'
  11225.      If set, enable the co-processor.  If reset, disable the
  11226.      co-processor.
  11227.  
  11228. `bit 1'
  11229.      If set, the emulation of the floating-point instructions will be
  11230.      done by the calling application.
  11231.  
  11232. DJGPP programs using one of the provided emulators should generally call
  11233. this functions with an argument of 2.  (The DJGPP startup code does that
  11234. automatically if no co-processor is detected.)
  11235.  
  11236. Return Value
  11237. ------------
  11238.  
  11239. -1 on errors, else zero.
  11240.  
  11241. Portability
  11242. -----------
  11243.  
  11244. not ANSI, not POSIX
  11245.  
  11246. 
  11247. File: libc.info,  Node: __dpmi_set_debug_watchpoint,  Next: __dpmi_set_descriptor,  Prev: __dpmi_set_coprocessor_emulation,  Up: Alphabetical List
  11248.  
  11249. __dpmi_set_debug_watchpoint
  11250. ===========================
  11251.  
  11252. Syntax
  11253. ------
  11254.  
  11255.      #include <dpmi.h>
  11256.      
  11257.      int __dpmi_set_debug_watchpoint(__dpmi_meminfo *_info, int _type);
  11258.  
  11259. Description
  11260. -----------
  11261.  
  11262. Please refer to *Note DPMI Specification:: for details on DPMI function
  11263. call operation.  Also see *Note DPMI Overview:: for general information.
  11264.  
  11265. DPMI function AX = 0x0b00
  11266.  
  11267. Set a debug breakpoint.  Type is 0 for execute, 1 for write, and 2 for
  11268. access.  Fill in address and size (1,2,4 bytes).  Server fills in
  11269. handle.
  11270.  
  11271. Return Value
  11272. ------------
  11273.  
  11274. -1 on error, else zero.
  11275.  
  11276. Portability
  11277. -----------
  11278.  
  11279. not ANSI, not POSIX
  11280.  
  11281. 
  11282. File: libc.info,  Node: __dpmi_set_descriptor,  Next: __dpmi_set_descriptor_access_rights,  Prev: __dpmi_set_debug_watchpoint,  Up: Alphabetical List
  11283.  
  11284. __dpmi_set_descriptor
  11285. =====================
  11286.  
  11287. Syntax
  11288. ------
  11289.  
  11290.      #include <dpmi.h>
  11291.      
  11292.      int __dpmi_set_descriptor(int _selector, void *_buffer);
  11293.  
  11294. Description
  11295. -----------
  11296.  
  11297. Please refer to *Note DPMI Specification:: for details on DPMI function
  11298. call operation.  Also see *Note DPMI Overview:: for general information.
  11299.  
  11300. DPMI function AX = 0x000c
  11301.  
  11302. This function sets the parameters of the selector _SELECTOR by copying
  11303. the contents of the 8-byte buffer pointed to by _BUFFER into the LDT
  11304. entry of the selector's descriptor.  *Note __dpmi_get_descriptor::, for
  11305. the description of the contents of the 8-byte buffer.
  11306.  
  11307. Return Value
  11308. ------------
  11309.  
  11310. -1 on error, else zero.
  11311.  
  11312. Portability
  11313. -----------
  11314.  
  11315. not ANSI, not POSIX
  11316.  
  11317. 
  11318. File: libc.info,  Node: __dpmi_set_descriptor_access_rights,  Next: __dpmi_set_extended_exception_handler_vector_pm,  Prev: __dpmi_set_descriptor,  Up: Alphabetical List
  11319.  
  11320. __dpmi_set_descriptor_access_rights
  11321. ===================================
  11322.  
  11323. Syntax
  11324. ------
  11325.  
  11326.      #include <dpmi.h>
  11327.      
  11328.      int __dpmi_set_descriptor_access_rights(int _selector, int _rights);
  11329.  
  11330. Description
  11331. -----------
  11332.  
  11333. Please refer to *Note DPMI Specification:: for details on DPMI function
  11334. call operation.  Also see *Note DPMI Overview:: for general information.
  11335.  
  11336. DPMI function AX = 0x0009
  11337.  
  11338. This sets the access rights of _SELECTOR to _RIGHTS.
  11339.  
  11340. The meaning of the individual bit fields of _RIGHTS is described below.
  11341. For more details, please refer to *Note __dpmi_get_descriptor::.
  11342.  
  11343.      ---- ---- ---- ---X = 0=not accessed, 1=accessed
  11344.      ---- ---- ---- --X- = data: 0=read, 1=r/w; code: 1=readable
  11345.      ---- ---- ---- -X-- = data: 0=expand-up, 1=expand-down; code: 0=non-conforming
  11346.      ---- ---- ---- X--- = 0=data, 1=code
  11347.      ---- ---- ---1 ---- = must be 1
  11348.      ---- ---- -XX- ---- = priviledge level (must equal CPL)
  11349.      ---- ---- X--- ---- = 0=absent, 1=present
  11350.      ---X ---- ---- ---- = available for the user
  11351.      --0- ---- ---- ---- = must be 0
  11352.      -X-- ---- ---- ---- = 0=16-bit 1=32-bit
  11353.      X--- ---- ---- ---- = 0=byte granular (small) 1=page-granular (big)
  11354.  
  11355. Return Value
  11356. ------------
  11357.  
  11358. -1 on error, else zero.
  11359.  
  11360. Portability
  11361. -----------
  11362.  
  11363. not ANSI, not POSIX
  11364.  
  11365. 
  11366. File: libc.info,  Node: __dpmi_set_extended_exception_handler_vector_pm,  Next: __dpmi_set_extended_exception_handler_vector_rm,  Prev: __dpmi_set_descriptor_access_rights,  Up: Alphabetical List
  11367.  
  11368. __dpmi_set_extended_exception_handler_vector_pm
  11369. ===============================================
  11370.  
  11371. Syntax
  11372. ------
  11373.  
  11374.      #include <dpmi.h>
  11375.      
  11376.      int __dpmi_set_extended_exception_handler_vector_pm(int vector,
  11377.                                                          __dpmi_paddr *address);
  11378.  
  11379. Description
  11380. -----------
  11381.  
  11382. Please refer to *Note DPMI Specification:: for details on DPMI function
  11383. call operation.  Also see *Note DPMI Overview:: for general information.
  11384.  
  11385. DPMI function AX = 0x0212 (DPMI 1.0 only).  Not supported by CWSDPMI and
  11386. Windows.
  11387.  
  11388. This function installs a handler for protected-mode exceptions.
  11389.  
  11390. Return Value
  11391. ------------
  11392.  
  11393. -1 on error, else zero.
  11394.  
  11395. Portability
  11396. -----------
  11397.  
  11398. not ANSI, not POSIX
  11399.  
  11400. 
  11401. File: libc.info,  Node: __dpmi_set_extended_exception_handler_vector_rm,  Next: __dpmi_set_multiple_descriptors,  Prev: __dpmi_set_extended_exception_handler_vector_pm,  Up: Alphabetical List
  11402.  
  11403. __dpmi_set_extended_exception_handler_vector_rm
  11404. ===============================================
  11405.  
  11406. Syntax
  11407. ------
  11408.  
  11409.      #include <dpmi.h>
  11410.      
  11411.      int __dpmi_set_extended_exception_handler_vector_rm(int vector,
  11412.                                                          __dpmi_paddr *address);
  11413.  
  11414. Description
  11415. -----------
  11416.  
  11417. Please refer to *Note DPMI Specification:: for details on DPMI function
  11418. call operation.  Also see *Note DPMI Overview:: for general information.
  11419.  
  11420. DPMI function AX = 0x0213 (DPMI 1.0 only).  Not supported by CWSDPMI and
  11421. Windows.
  11422.  
  11423. This function installs a handler for real-mode exceptions.
  11424.  
  11425. Return Value
  11426. ------------
  11427.  
  11428. -1 on error, else zero.
  11429.  
  11430. Portability
  11431. -----------
  11432.  
  11433. not ANSI, not POSIX
  11434.  
  11435. 
  11436. File: libc.info,  Node: __dpmi_set_multiple_descriptors,  Next: __dpmi_set_page_attributes,  Prev: __dpmi_set_extended_exception_handler_vector_rm,  Up: Alphabetical List
  11437.  
  11438. __dpmi_set_multiple_descriptors
  11439. ===============================
  11440.  
  11441. Syntax
  11442. ------
  11443.  
  11444.      #include <dpmi.h>
  11445.      
  11446.      int __dpmi_set_multiple_descriptors(int count, void *buffer);
  11447.  
  11448. Description
  11449. -----------
  11450.  
  11451. Please refer to *Note DPMI Specification:: for details on DPMI function
  11452. call operation.  Also see *Note DPMI Overview:: for general information.
  11453.  
  11454. DPMI function AX = 0x000f (DPMI 1.0 only).  Not supported by CWSDPMI and
  11455. Windows.
  11456.  
  11457. This function sets multiple descriptors.  Buffer usage is like in
  11458. `__dpmi_get_multiple_descriptors' (*note
  11459. __dpmi_get_multiple_descriptors::.), but the caller fills in everything
  11460. before calling.
  11461.  
  11462. Return Value
  11463. ------------
  11464.  
  11465. Returns COUNT if successful, the negative of the number of descriptors
  11466. set if failure.
  11467.  
  11468. Portability
  11469. -----------
  11470.  
  11471. not ANSI, not POSIX
  11472.  
  11473. 
  11474. File: libc.info,  Node: __dpmi_set_page_attributes,  Next: __dpmi_set_processor_exception_handler_vector,  Prev: __dpmi_set_multiple_descriptors,  Up: Alphabetical List
  11475.  
  11476. __dpmi_set_page_attributes
  11477. ==========================
  11478.  
  11479. Syntax
  11480. ------
  11481.  
  11482.      #include <dpmi.h>
  11483.      
  11484.      int __dpmi_set_page_attributes(__dpmi_meminfo *info, short *buffer);
  11485.  
  11486. Description
  11487. -----------
  11488.  
  11489. Please refer to *Note DPMI Specification:: for details on DPMI function
  11490. call operation.  Also see *Note DPMI Overview:: for general information.
  11491.  
  11492. DPMI function AX = 0x0507 (DPMI 1.0 only).  Supported by CWSDPMI, but
  11493. not by Windows.
  11494.  
  11495. This function sets attributes of a number of pages.  Pass handle in
  11496. `INFO->handle', offset within block in `INFO->address', and number of
  11497. pages in `INFO->count'.  BUFFER points to an array of 16-bit words
  11498. which specify the new attributes.  *Note __dpmi_get_page_attributes::,
  11499. for the definition of the page attribute word.
  11500.  
  11501. The DJGPP startup code calls this function to uncommit the so-called
  11502. "null page", the first 4KB of the program's address space.  This causes
  11503. `NULL' pointer dereferences, a frequent programmatic error, to trigger
  11504. a Page Fault exception, rather than go unnoticed.
  11505.  
  11506. Return Value
  11507. ------------
  11508.  
  11509. -1 on error, else zero.
  11510.  
  11511. Portability
  11512. -----------
  11513.  
  11514. not ANSI, not POSIX
  11515.  
  11516. 
  11517. File: libc.info,  Node: __dpmi_set_processor_exception_handler_vector,  Next: __dpmi_set_protected_mode_interrupt_vector,  Prev: __dpmi_set_page_attributes,  Up: Alphabetical List
  11518.  
  11519. __dpmi_set_processor_exception_handler_vector
  11520. =============================================
  11521.  
  11522. Syntax
  11523. ------
  11524.  
  11525.      #include <dpmi.h>
  11526.      
  11527.      int __dpmi_set_processor_exception_handler_vector(int _vector, __dpmi_paddr *_address);
  11528.  
  11529. Description
  11530. -----------
  11531.  
  11532. Please refer to *Note DPMI Specification:: for details on DPMI function
  11533. call operation.  Also see *Note DPMI Overview:: for general information.
  11534.  
  11535. DPMI function AX = 0x0203
  11536.  
  11537. This function installs a handler for protected mode exceptions (not
  11538. interrupts).  You must pass a selector:offset pair.
  11539.  
  11540. Return Value
  11541. ------------
  11542.  
  11543. -1 on error, else zero.
  11544.  
  11545. Portability
  11546. -----------
  11547.  
  11548. not ANSI, not POSIX
  11549.  
  11550. 
  11551. File: libc.info,  Node: __dpmi_set_protected_mode_interrupt_vector,  Next: __dpmi_set_real_mode_interrupt_vector,  Prev: __dpmi_set_processor_exception_handler_vector,  Up: Alphabetical List
  11552.  
  11553. __dpmi_set_protected_mode_interrupt_vector
  11554. ==========================================
  11555.  
  11556. Syntax
  11557. ------
  11558.  
  11559.      #include <dpmi.h>
  11560.      
  11561.      int __dpmi_set_protected_mode_interrupt_vector(int _vector, __dpmi_paddr *_address);
  11562.  
  11563. Description
  11564. -----------
  11565.  
  11566. Please refer to *Note DPMI Specification:: for details on DPMI function
  11567. call operation.  Also see *Note DPMI Overview:: for general information.
  11568.  
  11569. DPMI function AX = 0x0205
  11570.  
  11571. This function installs a protected-mode interrupt (not exception)
  11572. handler.  You must pass a selector:offset pair.  Hardware interrupts
  11573. will always be reflected to protected mode if you install a handler.
  11574. You must explicitely `sti' before `iret' because `iret' won't always
  11575. restore interrupts in a virtual environment.
  11576.  
  11577. Return Value
  11578. ------------
  11579.  
  11580. -1 on error, else zero.
  11581.  
  11582. Portability
  11583. -----------
  11584.  
  11585. not ANSI, not POSIX
  11586.  
  11587. 
  11588. File: libc.info,  Node: __dpmi_set_real_mode_interrupt_vector,  Next: __dpmi_set_segment_base_address,  Prev: __dpmi_set_protected_mode_interrupt_vector,  Up: Alphabetical List
  11589.  
  11590. __dpmi_set_real_mode_interrupt_vector
  11591. =====================================
  11592.  
  11593. Syntax
  11594. ------
  11595.  
  11596.      #include <dpmi.h>
  11597.      
  11598.      int __dpmi_set_real_mode_interrupt_vector(int _vector, __dpmi_raddr *_address);
  11599.  
  11600. Description
  11601. -----------
  11602.  
  11603. Please refer to *Note DPMI Specification:: for details on DPMI function
  11604. call operation.  Also see *Note DPMI Overview:: for general information.
  11605.  
  11606. DPMI function AX = 0x0201
  11607.  
  11608. This function sets a real-mode interrupt vector.  You must pass a
  11609. segment:offset pair, not a selector.
  11610.  
  11611. Bits [31:8] in the vector number are silently ignored.
  11612.  
  11613. Return Value
  11614. ------------
  11615.  
  11616. Zero.  This function always works.
  11617.  
  11618. Portability
  11619. -----------
  11620.  
  11621. not ANSI, not POSIX
  11622.  
  11623. 
  11624. File: libc.info,  Node: __dpmi_set_segment_base_address,  Next: __dpmi_set_segment_limit,  Prev: __dpmi_set_real_mode_interrupt_vector,  Up: Alphabetical List
  11625.  
  11626. __dpmi_set_segment_base_address
  11627. ===============================
  11628.  
  11629. Syntax
  11630. ------
  11631.  
  11632.      #include <dpmi.h>
  11633.      
  11634.      int __dpmi_set_segment_base_address(int _selector, unsigned _address);
  11635.  
  11636. Description
  11637. -----------
  11638.  
  11639. Please refer to *Note DPMI Specification:: for details on DPMI function
  11640. call operation.  Also see *Note DPMI Overview:: for general information.
  11641.  
  11642. DPMI function AX = 0x0007
  11643.  
  11644. This function sets the base address of the _SELECTOR to _ADDRESS.
  11645.  
  11646. Return Value
  11647. ------------
  11648.  
  11649. -1 on error, else zero.
  11650.  
  11651. Portability
  11652. -----------
  11653.  
  11654. not ANSI, not POSIX
  11655.  
  11656. 
  11657. File: libc.info,  Node: __dpmi_set_segment_limit,  Next: __dpmi_simulate_real_mode_interrupt,  Prev: __dpmi_set_segment_base_address,  Up: Alphabetical List
  11658.  
  11659. __dpmi_set_segment_limit
  11660. ========================
  11661.  
  11662. Syntax
  11663. ------
  11664.  
  11665.      #include <dpmi.h>
  11666.      
  11667.      int __dpmi_set_segment_limit(int _selector, unsigned _address);
  11668.  
  11669. Description
  11670. -----------
  11671.  
  11672. Please refer to *Note DPMI Specification:: for details on DPMI function
  11673. call operation.  Also see *Note DPMI Overview:: for general information.
  11674.  
  11675. DPMI function AX = 0x0008
  11676.  
  11677. This function sets the highest valid address in the segment referenced
  11678. by _SELECTOR.  For example, if you pass 0xfffff, the highest valid
  11679. address is 0xfffff.  Note: if you pass a number <= 64K, the segment
  11680. changes to "non-big", and may cause unexpected problems.  Limits for
  11681. segments larger than 1MB must have their low 12 bits set.
  11682.  
  11683. Return Value
  11684. ------------
  11685.  
  11686. -1 on error, else zero.
  11687.  
  11688. Portability
  11689. -----------
  11690.  
  11691. not ANSI, not POSIX
  11692.  
  11693. 
  11694. File: libc.info,  Node: __dpmi_simulate_real_mode_interrupt,  Next: __dpmi_simulate_real_mode_procedure_iret,  Prev: __dpmi_set_segment_limit,  Up: Alphabetical List
  11695.  
  11696. __dpmi_simulate_real_mode_interrupt
  11697. ===================================
  11698.  
  11699. Syntax
  11700. ------
  11701.  
  11702.      #include <dpmi.h>
  11703.      
  11704.      int __dpmi_simulate_real_mode_interrupt(int _vector, __dpmi_regs *_regs);
  11705.  
  11706. Description
  11707. -----------
  11708.  
  11709. Please refer to *Note DPMI Specification:: for details on DPMI function
  11710. call operation.  Also see *Note DPMI Overview:: for general information.
  11711.  
  11712. DPMI function AX = 0x0300
  11713.  
  11714. This function performs a software interrupt in real mode after filling
  11715. in *all* the registers from the given structure.  You *must* set %ss,
  11716. %esp, and %eflags to valid real-mode values or zero, unlike *Note
  11717. __dpmi_int::.
  11718.  
  11719. Return Value
  11720. ------------
  11721.  
  11722. -1 on error, else zero.
  11723.  
  11724. Portability
  11725. -----------
  11726.  
  11727. not ANSI, not POSIX
  11728.  
  11729. 
  11730. File: libc.info,  Node: __dpmi_simulate_real_mode_procedure_iret,  Next: __dpmi_simulate_real_mode_procedure_retf,  Prev: __dpmi_simulate_real_mode_interrupt,  Up: Alphabetical List
  11731.  
  11732. __dpmi_simulate_real_mode_procedure_iret
  11733. ========================================
  11734.  
  11735. Syntax
  11736. ------
  11737.  
  11738.      #include <dpmi.h>
  11739.      
  11740.      int __dpmi_simulate_real_mode_procedure_iret(__dpmi_regs *_regs);
  11741.  
  11742. Description
  11743. -----------
  11744.  
  11745. Please refer to *Note DPMI Specification:: for details on DPMI function
  11746. call operation.  Also see *Note DPMI Overview:: for general information.
  11747.  
  11748. DPMI function AX = 0x0302
  11749.  
  11750. This function switches to real mode, filling in *all* the registers
  11751. from the structure.  ss:sp and flags must be valid or zero.  The called
  11752. function must return with an `iret'.
  11753.  
  11754. Return Value
  11755. ------------
  11756.  
  11757. -1 on error, else zero.
  11758.  
  11759. Portability
  11760. -----------
  11761.  
  11762. not ANSI, not POSIX
  11763.  
  11764. 
  11765. File: libc.info,  Node: __dpmi_simulate_real_mode_procedure_retf,  Next: __dpmi_simulate_real_mode_procedure_retf_stack,  Prev: __dpmi_simulate_real_mode_procedure_iret,  Up: Alphabetical List
  11766.  
  11767. __dpmi_simulate_real_mode_procedure_retf
  11768. ========================================
  11769.  
  11770. Syntax
  11771. ------
  11772.  
  11773.      #include <dpmi.h>
  11774.      
  11775.      int __dpmi_simulate_real_mode_procedure_retf(__dpmi_regs *_regs);
  11776.  
  11777. Description
  11778. -----------
  11779.  
  11780. Please refer to *Note DPMI Specification:: for details on DPMI function
  11781. call operation.  Also see *Note DPMI Overview:: for general information.
  11782.  
  11783. DPMI function AX = 0x0301
  11784.  
  11785. This function switches to real mode with *all* the registers set from
  11786. the structure, including cs:ip.  The function called should return with
  11787. a `retf'.  ss:sp and flags must be set to valid values or zero.
  11788.  
  11789. Return Value
  11790. ------------
  11791.  
  11792. -1 on error, else zero.
  11793.  
  11794. Portability
  11795. -----------
  11796.  
  11797. not ANSI, not POSIX
  11798.  
  11799. 
  11800. File: libc.info,  Node: __dpmi_simulate_real_mode_procedure_retf_stack,  Next: __dpmi_terminate_and_stay_resident,  Prev: __dpmi_simulate_real_mode_procedure_retf,  Up: Alphabetical List
  11801.  
  11802. __dpmi_simulate_real_mode_procedure_retf_stack
  11803. ==============================================
  11804.  
  11805. Syntax
  11806. ------
  11807.  
  11808.      #include <dpmi.h>
  11809.      
  11810.      int __dpmi_simulate_real_mode_procedure_retf_stack(__dpmi_regs *_regs, int stack_words_to_copy, const void *stack_data);
  11811.  
  11812. Description
  11813. -----------
  11814.  
  11815. Please refer to *Note DPMI Specification:: for details on DPMI function
  11816. call operation.  Also see *Note DPMI Overview:: for general information.
  11817.  
  11818. DPMI function AX = 0x0301
  11819.  
  11820. This function switches to real mode with *all* the registers set from
  11821. the structure, including cs:ip.  The function called should return with
  11822. a `retf'.  ss:sp and flags must be set to valid values or zero.
  11823.  
  11824. You may optionally specify data to be copied to the real-mode stack, to
  11825. pass arguments to real-mode procedures with stack-based calling
  11826. conventions.  If you don't want to copy data to the real mode stack,
  11827. pass 0 for STACK_WORDS_TO_COPY, and `NULL' for STACK_BYTES.
  11828.  
  11829. Note that the amount of stack data to be copied should be given in units
  11830. of 16-bit words, not in bytes.  This is defined by the underlying DPMI
  11831. function.
  11832.  
  11833. Return Value
  11834. ------------
  11835.  
  11836. -1 on error, else zero.
  11837.  
  11838. Portability
  11839. -----------
  11840.  
  11841. not ANSI, not POSIX
  11842.  
  11843. 
  11844. File: libc.info,  Node: __dpmi_terminate_and_stay_resident,  Next: __dpmi_unlock_linear_region,  Prev: __dpmi_simulate_real_mode_procedure_retf_stack,  Up: Alphabetical List
  11845.  
  11846. __dpmi_terminate_and_stay_resident
  11847. ==================================
  11848.  
  11849. Syntax
  11850. ------
  11851.  
  11852.      #include <dpmi.h>
  11853.      
  11854.      int __dpmi_terminate_and_stay_resident(int return_code,
  11855.                                             int paragraphs_to_keep);
  11856.  
  11857. Description
  11858. -----------
  11859.  
  11860. Please refer to *Note DPMI Specification:: for details on DPMI function
  11861. call operation.  Also see *Note DPMI Overview:: for general information.
  11862.  
  11863. DPMI function AX = 0x0c01 (DPMI 1.0 only).  Not supported by CWSDPMI and
  11864. Windows.
  11865.  
  11866. This function terminates the calling program, but leaves it resident in
  11867. memory.  RETURN_CODE specifies which value to return to the OS.
  11868. PARAGRAPHS_TO_KEEP specifies the number of paragraphs of DOS
  11869. (conventional) memory to keep; it should be either zero or 6 or more.
  11870. Note that any protected-mode memory remains allocated to the program
  11871. unless explicitly freed before calling this function.
  11872.  
  11873. The calling program *must* call the function
  11874. `__dpmi_install_resident_service_provider_callback' before this one,
  11875. otherwise it will be terminated instead of going TSR.  *Note
  11876. __dpmi_install_resident_service_provider_callback::.
  11877.  
  11878. Return Value
  11879. ------------
  11880.  
  11881. This call does not return.
  11882.  
  11883. Portability
  11884. -----------
  11885.  
  11886. not ANSI, not POSIX
  11887.  
  11888. 
  11889. File: libc.info,  Node: __dpmi_unlock_linear_region,  Next: __dpmi_yield,  Prev: __dpmi_terminate_and_stay_resident,  Up: Alphabetical List
  11890.  
  11891. __dpmi_unlock_linear_region
  11892. ===========================
  11893.  
  11894. Syntax
  11895. ------
  11896.  
  11897.      #include <dpmi.h>
  11898.      
  11899.      int __dpmi_unlock_linear_region(__dpmi_meminfo *_info);
  11900.  
  11901. Description
  11902. -----------
  11903.  
  11904. Please refer to *Note DPMI Specification:: for details on DPMI function
  11905. call operation.  Also see *Note DPMI Overview:: for general information.
  11906.  
  11907. DPMI function AX = 0x0601
  11908.  
  11909. This function unlocks virtual memory.  Pass address and size (in bytes).
  11910.  
  11911. Return Value
  11912. ------------
  11913.  
  11914. -1 on error, else zero.
  11915.  
  11916. Portability
  11917. -----------
  11918.  
  11919. not ANSI, not POSIX
  11920.  
  11921. 
  11922. File: libc.info,  Node: __dpmi_yield,  Next: dup,  Prev: __dpmi_unlock_linear_region,  Up: Alphabetical List
  11923.  
  11924. __dpmi_yield
  11925. ============
  11926.  
  11927. Syntax
  11928. ------
  11929.  
  11930.      #include <dpmi.h>
  11931.      
  11932.      void __dpmi_yield(void);
  11933.  
  11934. Description
  11935. -----------
  11936.  
  11937. `__dpmi_yield' calls function 1680h of the interrupt 2Fh, which tells
  11938. the task manager in a multitasking environment that the calling program
  11939. doesn't need the rest of its time slice.  The task manager will then
  11940. preempt the calling program and switch to another task that is ready to
  11941. run.
  11942.  
  11943. This function should be called in busy-wait loops, like when a program
  11944. waits for user input via keyboard, after it finds the keyboard buffer
  11945. empty, to enhance overall performance in a multitasking environment.
  11946.  
  11947. Return Value
  11948. ------------
  11949.  
  11950. None.  If the call isn't supported by the environment, like when running
  11951. on plain DOS, `errno' is set to `ENOSYS'.
  11952.  
  11953. Portability
  11954. -----------
  11955.  
  11956. not ANSI, not POSIX
  11957.  
  11958. 
  11959. File: libc.info,  Node: dup,  Next: dup2,  Prev: __dpmi_yield,  Up: Alphabetical List
  11960.  
  11961. dup
  11962. ===
  11963.  
  11964. Syntax
  11965. ------
  11966.  
  11967.      #include <unistd.h>
  11968.      
  11969.      int dup(int old_handle);
  11970.  
  11971. Description
  11972. -----------
  11973.  
  11974. This function duplicates the given file handle.  Both handles refer to
  11975. the same file and file pointer.
  11976.  
  11977. Return Value
  11978. ------------
  11979.  
  11980. The new file handle, or -1 if error.
  11981.  
  11982. Portability
  11983. -----------
  11984.  
  11985. not ANSI, POSIX
  11986.  
  11987. Example
  11988. -------
  11989.  
  11990.      do_file(dup(fileno(stdin)));
  11991.  
  11992. 
  11993. File: libc.info,  Node: dup2,  Next: _dxe_load,  Prev: dup,  Up: Alphabetical List
  11994.  
  11995. dup2
  11996. ====
  11997.  
  11998. Syntax
  11999. ------
  12000.  
  12001.      #include <unistd.h>
  12002.      
  12003.      int dup2(int existing_handle, int new_handle);
  12004.  
  12005. Description
  12006. -----------
  12007.  
  12008. This call causes NEW_HANDLE to refer to the same file and file pointer
  12009. as EXISTING_HANDLE.  If NEW_HANDLE is an open file, it is closed.
  12010.  
  12011. Return Value
  12012. ------------
  12013.  
  12014. The new handle, or -1 on error.
  12015.  
  12016. Portability
  12017. -----------
  12018.  
  12019. not ANSI, POSIX
  12020.  
  12021. Example
  12022. -------
  12023.  
  12024.      /* copy new file to stdin stream */
  12025.      close(0);
  12026.      dup2(new_stdin, 0);
  12027.      close(new_stdin);
  12028.  
  12029. 
  12030. File: libc.info,  Node: _dxe_load,  Next: ecvt,  Prev: dup2,  Up: Alphabetical List
  12031.  
  12032. _dxe_load
  12033. =========
  12034.  
  12035. Syntax
  12036. ------
  12037.  
  12038.      #include <sys/dxe.h>
  12039.      
  12040.      void *_dxe_load(char *dxe_filename);
  12041.  
  12042. Description
  12043. -----------
  12044.  
  12045. This function loads a dynamic executable image, whose file name is
  12046. pointed to by DXE_FILENAME, into memory and returns the entry point for
  12047. the symbol associated with the image.  The symbol may point to a
  12048. structure or a function.
  12049.  
  12050. Return Value
  12051. ------------
  12052.  
  12053. 0 on failure, the address of the loaded symbol on success.
  12054.  
  12055. Portability
  12056. -----------
  12057.  
  12058. not ANSI, not POSIX
  12059.  
  12060. Example
  12061. -------
  12062.  
  12063.        static int (*add)(int a, int b);
  12064.      
  12065.        add = _dxe_load("add.dxe");
  12066.        if (add == 0)
  12067.          printf("Cannot load add.dxe\n");
  12068.        else
  12069.          printf("Okay, 3 + 4 = %d\n", add(3,4));
  12070.  
  12071. 
  12072. File: libc.info,  Node: ecvt,  Next: ecvtbuf,  Prev: _dxe_load,  Up: Alphabetical List
  12073.  
  12074. ecvt
  12075. ====
  12076.  
  12077. Syntax
  12078. ------
  12079.  
  12080.      #include <stdlib.h>
  12081.      
  12082.      char * ecvt (double value, int ndigits, int *decpt, int *sign)
  12083.  
  12084. Description
  12085. -----------
  12086.  
  12087. This function converts the VALUE into a null-terminated string, and
  12088. returns a pointer to that string.
  12089.  
  12090. `ecvt' works exactly like `ecvtbuf' (*note ecvtbuf::.), except that it
  12091. generates the string in an internal static buffer which is overwritten
  12092. on each call.
  12093.  
  12094. Return Value
  12095. ------------
  12096.  
  12097. A pointer to the generated string.
  12098.  
  12099. Portability
  12100. -----------
  12101.  
  12102. not ANSI, not POSIX
  12103.  
  12104. 
  12105. File: libc.info,  Node: ecvtbuf,  Next: edi_init,  Prev: ecvt,  Up: Alphabetical List
  12106.  
  12107. ecvtbuf
  12108. =======
  12109.  
  12110. Syntax
  12111. ------
  12112.  
  12113.      #include <stdlib.h>
  12114.      
  12115.      char * ecvtbuf (double value, int ndigits, int *decpt, int *sign, char *buf)
  12116.  
  12117. Description
  12118. -----------
  12119.  
  12120. This function converts its argument VALUE into a null-terminated string
  12121. of NDIGITS digits in BUF.  BUF should have enough space to hold at
  12122. least `NDIGITS + 1' characters.
  12123.  
  12124. The produced string in BUF does *not* include the decimal point.
  12125. Instead, the position of the decimal point relative to the beginning of
  12126. BUF is stored in an integer variable whose address is passed in DECPT.
  12127. Thus, if BUF is returned as "1234" and *DECPT as 1, this corresponds to
  12128. a value of 1.234; if *DECPT is -1, this corresponds to a value of
  12129. 0.01234, etc.
  12130.  
  12131. The sign is also not included in BUF's value.  If VALUE is negative,
  12132. `ecvtbuf' puts a nonzero value into the variable whose address is
  12133. passed in SIGN; otherwise it stores zero in *SIGN.
  12134.  
  12135. The least-significant digit in BUF is rounded.
  12136.  
  12137. `ecvtbuf' produces the string "NaN" if VALUE is a NaN, and "Inf" or
  12138. "Infinity" if VALUE is an infinity (the longer form is produced when
  12139. NDIGITS is 8 or more).
  12140.  
  12141. Return Value
  12142. ------------
  12143.  
  12144. A pointer to BUF.
  12145.  
  12146. Portability
  12147. -----------
  12148.  
  12149. not ANSI, not POSIX
  12150.  
  12151. Example
  12152. -------
  12153.  
  12154.        #include <stdlib.h>
  12155.        #include <stdio.h>
  12156.        #include <math.h>
  12157.      
  12158.        char vbuf[20];
  12159.        int esign, edecpt;
  12160.      
  12161.        ecvtbuf (M_PI, 5, &edecpt, &esign, buf)
  12162.        /* This will print " 31416".  */
  12163.        printf ("%c%s", esign ? '-' : ' ', buf);
  12164.  
  12165. 
  12166. File: libc.info,  Node: edi_init,  Next: enable,  Prev: ecvtbuf,  Up: Alphabetical List
  12167.  
  12168. edi_init
  12169. ========
  12170.  
  12171. Syntax
  12172. ------
  12173.  
  12174.      #include <debug/dbgcom.h>
  12175.      
  12176.      void edi_init (jmp_buf start_state);
  12177.  
  12178. Description
  12179. -----------
  12180.  
  12181. This function is part of the DJGPP "debugging support".  It should be
  12182. called after a call to `v2loadimage' (*note v2loadimage::.) which loads
  12183. an executable program as a debuggee.  `edi_init' then takes care of
  12184. initializing the data structures which need to be set before the
  12185. debugger can set breakpoints and run the debuggee.
  12186.  
  12187. The argument START_STATE is usually set by a preceding call to
  12188. `v2loadimage'.
  12189.  
  12190. Portability
  12191. -----------
  12192.  
  12193. not ANSI, not POSIX
  12194.  
  12195. Example
  12196. -------
  12197.  
  12198.       if (v2loadimage (exec_file, cmdline, start_state))
  12199.         {
  12200.            printf ("Load failed for image %s\n", exec_file);
  12201.            exit (1);
  12202.         }
  12203.      
  12204.        edi_init (start_state);
  12205.  
  12206. 
  12207. File: libc.info,  Node: enable,  Next: endgrent,  Prev: edi_init,  Up: Alphabetical List
  12208.  
  12209. enable
  12210. ======
  12211.  
  12212. Syntax
  12213. ------
  12214.  
  12215.      #include <dos.h>
  12216.      
  12217.      int enable(void);
  12218.  
  12219. Description
  12220. -----------
  12221.  
  12222. This function enables interrupts.
  12223.  
  12224. *Note disable::.
  12225.  
  12226. Return Value
  12227. ------------
  12228.  
  12229. Returns nonzero if the interrupts were already enabled, zero if they
  12230. had been disabled before this call.
  12231.  
  12232. Portability
  12233. -----------
  12234.  
  12235. not ANSI, not POSIX
  12236.  
  12237. Example
  12238. -------
  12239.  
  12240.      int ints_were_enabled;
  12241.      
  12242.      ints_were_enabled = enable();
  12243.      . . . do some stuff . . .
  12244.      if (!ints_were_enabled)
  12245.        disable();
  12246.  
  12247. 
  12248. File: libc.info,  Node: endgrent,  Next: endmntent,  Prev: enable,  Up: Alphabetical List
  12249.  
  12250. endgrent
  12251. ========
  12252.  
  12253. Syntax
  12254. ------
  12255.  
  12256.      #include <grp.h>
  12257.      
  12258.      void endgrent(void);
  12259.  
  12260. Description
  12261. -----------
  12262.  
  12263. This function should be called after all calls to `getgrent',
  12264. `getgrgid', or `getgrnam'.
  12265.  
  12266. Return Value
  12267. ------------
  12268.  
  12269. None.
  12270.  
  12271. Portability
  12272. -----------
  12273.  
  12274. not ANSI, not POSIX
  12275.  
  12276. Example
  12277. -------
  12278.  
  12279. *Note getgrent::.
  12280.  
  12281. 
  12282. File: libc.info,  Node: endmntent,  Next: endpwent,  Prev: endgrent,  Up: Alphabetical List
  12283.  
  12284. endmntent
  12285. =========
  12286.  
  12287. Syntax
  12288. ------
  12289.  
  12290.      #include <mntent.h>
  12291.      
  12292.      int endmntent(FILE *filep);
  12293.  
  12294. Description
  12295. -----------
  12296.  
  12297. This function should be called after the last call to `getmntent'
  12298. (*note getmntent::.).
  12299.  
  12300. Return Value
  12301. ------------
  12302.  
  12303. This function always returns one.
  12304.  
  12305. Portability
  12306. -----------
  12307.  
  12308. not ANSI, not POSIX
  12309.  
  12310. 
  12311. File: libc.info,  Node: endpwent,  Next: errno,  Prev: endmntent,  Up: Alphabetical List
  12312.  
  12313. endpwent
  12314. ========
  12315.  
  12316. Syntax
  12317. ------
  12318.  
  12319.      #include <pwd.h>
  12320.      
  12321.      void endpwent(void);
  12322.  
  12323. Description
  12324. -----------
  12325.  
  12326. This function should be called after the last call to getpwent (*note
  12327. getpwent::.).
  12328.  
  12329. Return Value
  12330. ------------
  12331.  
  12332. None.
  12333.  
  12334. Portability
  12335. -----------
  12336.  
  12337. not ANSI, not POSIX
  12338.  
  12339. 
  12340. File: libc.info,  Node: errno,  Next: exec*,  Prev: endpwent,  Up: Alphabetical List
  12341.  
  12342. errno
  12343. =====
  12344.  
  12345. Syntax
  12346. ------
  12347.  
  12348.      #include <errno.h>
  12349.      
  12350.      extern int errno;
  12351.  
  12352. Description
  12353. -----------
  12354.  
  12355. This variable is used to hold the value of the error of the last
  12356. function call.  The value might be one of the following:
  12357.  
  12358. `0'
  12359.      No Error.  Library functions never set `errno' to zero, but the
  12360.      startup code does that just before calling `main' (this is ANSI C
  12361.      requirement).
  12362.  
  12363. `1'
  12364.      EDOM - Numerical input to a function is out of range.
  12365.  
  12366. `2'
  12367.      ERANGE - Numerical output of a function is out of range.
  12368.  
  12369. `3'
  12370.      E2BIG - Argument list too long.  `system' and the functions from
  12371.      the `spawn' family assign this to `errno' when the command line is
  12372.      too long (longer than 126-character limit when invoking non-DJGPP
  12373.      programs, or longer than the transfer buffer size when invoking
  12374.      DJGPP programs).
  12375.  
  12376. `4'
  12377.      EACCES - Permission denied.  Attempt to write to a read-only file,
  12378.      or remove a non-empty directory, or open a directory as if it were
  12379.      a file, etc.  In essence, it's a DOS way of saying "You can't do
  12380.      that, but I'm too stupid to know why."
  12381.  
  12382. `5'
  12383.      EAGAIN - Resource temporarily unavailable, try again later.  Almost
  12384.      never used in DJGPP, except when DOS returns error code 3Dh
  12385.      ("network print queue full") 81h (NetWare4 "CWait children still
  12386.      running") or 9Bh (NetWare4 "unable to create another TCB").
  12387.  
  12388. `6'
  12389.      EBADF - Bad file descriptor: an invalid file handle passed to a
  12390.      library function.
  12391.  
  12392. `7'
  12393.      EBUSY - Resource busy.  Attempt to remove current directory
  12394.      (including current directory on another drive), or when a
  12395.      networked resource, such as a drive, is in use by another process.
  12396.  
  12397. `8'
  12398.      ECHILD - No child processes.  Returned by `wait' and `waitpid',
  12399.      and by NetWare-related calls.
  12400.  
  12401. `9'
  12402.      EDEADLK - Resource deadlock avoided.  Never used in DJGPP.
  12403.  
  12404. `10'
  12405.      EEXIST - File exists.  Returned by `open' and `mkdir' when a file
  12406.      or directory by that name already exists.
  12407.  
  12408. `11'
  12409.      EFAULT - Bad address.  A function was passed a bad pointer (like a
  12410.      `NULL' pointer).
  12411.  
  12412. `12'
  12413.      EFBIG - File too large.  Never used in DJGPP.
  12414.  
  12415. `13'
  12416.      EINTR - Interrupted system call.  `system' and the functions of
  12417.      the `spawn' family use that when the child program was interrupted
  12418.      by `Ctrl-<C>'.  Also, when DOS returns the "fail on INT 24h" error
  12419.      code.
  12420.  
  12421. `14'
  12422.      EINVAL - Invalid argument.  Any case when any argument to a library
  12423.      function is found to be invalid.  Examples include invalid drive
  12424.      number, "." or ".." as one of the arguments to `rename', syntax
  12425.      errors in the command line passed to `system', etc.
  12426.  
  12427. `15'
  12428.      EIO - Input or output error.  Low-level error in I/O operation,
  12429.      like bad disk block, damaged FAT, etc.
  12430.  
  12431. `16'
  12432.      EISDIR - Is a directory: an attempt to do something with a
  12433.      directory which is only allowed with regular files.  DOS usually
  12434.      returns `EACCES' in these cases, but DJGPP sometimes assigns
  12435.      `EISDIR' to `errno', like when `rename' is called to move a regular
  12436.      file over a directory, or when `system' or one of the `spawn*'
  12437.      functions are passed a name of a directory instead of an executable
  12438.      program.
  12439.  
  12440. `17'
  12441.      EMFILE - Too many open files in system (no more handles available).
  12442.      This usually means that the number specified by the `FILES='
  12443.      directive in `CONFIG.SYS' is too small.
  12444.  
  12445. `18'
  12446.      EMLINK - Too many links.  Not used in DJGPP (as DOS doesn't support
  12447.      links).
  12448.  
  12449. `19'
  12450.      ENAMETOOLONG - File name too long (longer than `FILENAME_MAX',
  12451.      defined in `stdio.h').
  12452.  
  12453. `20'
  12454.      ENFILE - Too many open files.  Never used in DJGPP.
  12455.  
  12456. `21'
  12457.      ENODEV - No such device.  Attempt to access an invalid drive, or an
  12458.      invalid operation for the type of drive.
  12459.  
  12460. `22'
  12461.      ENOENT - No such file or directory.
  12462.  
  12463. `23'
  12464.      ENOEXEC - Unable to execute file.  Returned by `_dxe_load' (when
  12465.      the argument names a file that isn't a valid DXE), and by
  12466.      NetWare-related calls which run programs remotely.
  12467.  
  12468. `24'
  12469.      ENOLCK - No locks available.  Returned when the DOS file-locking
  12470.      functions cannot lock more files (due to overflow of the sharing
  12471.      buffer).
  12472.  
  12473. `25'
  12474.      ENOMEM - Not enough memory.  Note that, unlike your expectations,
  12475.      `malloc' does NOT set `errno' to `ENOMEM'; however, several
  12476.      library functions that use `malloc' will do that when it returns a
  12477.      `NULL' pointer.
  12478.  
  12479. `26'
  12480.      ENOSPC - No space left on drive.  DOS usually doesn't return this
  12481.      error, but `write' and `_write' do this for it, when they detect a
  12482.      full disk condition.
  12483.  
  12484. `27'
  12485.      ENOSYS - Function not implemented.  Any system call that isn't
  12486.      supported by the underlying OS, like an LFN function when running
  12487.      on plain DOS.
  12488.  
  12489. `28'
  12490.      ENOTDIR - Not a directory.  DOS never returns this code, but some
  12491.      library functions, like `rename' and `_truename', do that if they
  12492.      expect a valid directory pathname, but get either an invalid (e.g.
  12493.      empty) pathname or a file that is not a directory.
  12494.  
  12495. `29'
  12496.      ENOTEMPTY - Directory not empty.  DOS never returns this code, but
  12497.      `rename' does, when it is called to move a directory over an
  12498.      existing non-empty directory.
  12499.  
  12500. `30'
  12501.      ENOTTY - Inappropriate I/O control operation.  The "termios"
  12502.      functions set `errno' to this when called on a device that is not a
  12503.      TTY.
  12504.  
  12505. `31'
  12506.      ENXIO - No such device or address.  An operation attempted to
  12507.      reference a device (not a disk drive) that is invalid, or
  12508.      non-existent, or access a disk drive that exists but is empty.
  12509.  
  12510. `32'
  12511.      EPERM - Operation not permitted.  Examples include: sharing or file
  12512.      lock violations; denial of access to networked resources; expired
  12513.      password or illegal login attempts via a network; too many or
  12514.      duplicate network redirections; etc.
  12515.  
  12516. `33'
  12517.      EPIPE - Broken pipe: attempt to write to a pipe with nobody to read
  12518.      it.  This never happens in DJGPP.
  12519.  
  12520. `34'
  12521.      EROFS - Read-only file system: attempt to write to a read-only
  12522.      disk.  Unfortunately, DOS almost never returns this code.
  12523.  
  12524. `35'
  12525.      ESPIPE - Invalid seek: attempt to seek on a pipe.  Never happens in
  12526.      DJGPP, except for NetWare-related operations, since pipes are
  12527.      simulated with regular files in MS-DOS, and therefore are always
  12528.      seekable.
  12529.  
  12530. `36'
  12531.      ESRCH - No such process.  Not used in DJGPP.
  12532.  
  12533. `37'
  12534.      EXDEV - Improper link.  An attempt to rename a file across drives,
  12535.      or create a "symlink" to a file that is not an executable DJGPP
  12536.      v2.x program.
  12537.  
  12538. `38'
  12539.      ENMFILE - No more files.  `findfirst' and `findnext' assign this
  12540.      to `errno' when they exhaust the files in the directory.
  12541.      `readdir' does that as well.
  12542.  
  12543. *Note perror::.
  12544.  
  12545. Portability
  12546. -----------
  12547.  
  12548. ANSI, POSIX
  12549.  
  12550. 
  12551. File: libc.info,  Node: exec*,  Next: __exit,  Prev: errno,  Up: Alphabetical List
  12552.  
  12553. exec*
  12554. =====
  12555.  
  12556. Syntax
  12557. ------
  12558.  
  12559.      #include <unistd.h>
  12560.      
  12561.      int execl(const char *path, const char *argv0, ...);
  12562.      int execle(const char *path, const char *argv0, ... /*, char *const envp[] */);
  12563.      int execlp(const char *path, const char *argv0, ...);
  12564.      int execlpe(const char *path, const char *argv0, ... /*, char *const envp[] */);
  12565.      
  12566.      int execv(const char *path, char *const argv[]);
  12567.      int execve(const char *path, char *const argv[], char *const envp[]);
  12568.      int execvp(const char *path, char *const argv[]);
  12569.      int execvpe(const char *path, char *const argv[], char *const envp[]);
  12570.  
  12571. Description
  12572. -----------
  12573.  
  12574. These functions operate by calling `spawn*' with a type of `P_OVERLAY'.
  12575. Refer to *Note spawn*:: for a full description.
  12576.  
  12577. Return Value
  12578. ------------
  12579.  
  12580. If successful, these functions do not return.  If there is an error,
  12581. these functions return -1 and set `errno' to indicate the error.
  12582.  
  12583. Portability
  12584. -----------
  12585.  
  12586. not ANSI, POSIX
  12587.  
  12588. Example
  12589. -------
  12590.  
  12591.      execlp("gcc", "gcc", "-v", "hello.c", 0);
  12592.  
  12593. 
  12594. File: libc.info,  Node: __exit,  Next: _exit,  Prev: exec*,  Up: Alphabetical List
  12595.  
  12596. __exit
  12597. ======
  12598.  
  12599. Syntax
  12600. ------
  12601.  
  12602.      #include <unistd.h>
  12603.      
  12604.      void __exit(int exit_code);
  12605.  
  12606. Description
  12607. -----------
  12608.  
  12609. This is an internal library function which exits the program, returning
  12610. EXIT_CODE to the calling process.  No additional processing is done,
  12611. and any `atexit' functions are not called.  Since hardware interrupts
  12612. are not unhooked, this can cause crashes after the program exits. This
  12613. function is normally called only by `_exit'; do *not* call it directly.
  12614.  
  12615. Return Value
  12616. ------------
  12617.  
  12618. This function does not return.
  12619.  
  12620. Portability
  12621. -----------
  12622.  
  12623. not ANSI, POSIX
  12624.  
  12625. 
  12626. File: libc.info,  Node: _exit,  Next: exit,  Prev: __exit,  Up: Alphabetical List
  12627.  
  12628. _exit
  12629. =====
  12630.  
  12631. Syntax
  12632. ------
  12633.  
  12634.      #include <unistd.h>
  12635.      
  12636.      void _exit(int exit_code);
  12637.  
  12638. Description
  12639. -----------
  12640.  
  12641. This function exits the program, returning EXIT_CODE to the calling
  12642. process.  No additional processing (such as closing file descriptors or
  12643. calls to the static destructor functions) is done, and any `atexit'
  12644. functions are not called; only the hardware interrupt handlers are
  12645. unhooked, to prevent system crashes e.g. after a call to `abort'.  This
  12646. function is normally called only by `exit' and `abort'.
  12647.  
  12648. Return Value
  12649. ------------
  12650.  
  12651. This function does not return.
  12652.  
  12653. Portability
  12654. -----------
  12655.  
  12656. not ANSI, not POSIX
  12657.  
  12658. 
  12659. File: libc.info,  Node: exit,  Next: exp,  Prev: _exit,  Up: Alphabetical List
  12660.  
  12661. exit
  12662. ====
  12663.  
  12664. Syntax
  12665. ------
  12666.  
  12667.      #include <stdlib.h>
  12668.      
  12669.      void exit(int exit_code);
  12670.  
  12671. Description
  12672. -----------
  12673.  
  12674. This function exits the program, returning EXIT_CODE to the calling
  12675. process.  Before exiting, all open files are closed and all `atexit'
  12676. and `on_exit' requests are processed.
  12677.  
  12678. Return Value
  12679. ------------
  12680.  
  12681. This function does not return.
  12682.  
  12683. Portability
  12684. -----------
  12685.  
  12686. ANSI, POSIX
  12687.  
  12688. Example
  12689. -------
  12690.  
  12691.      if (argc < 4)
  12692.      {
  12693.        print_usage();
  12694.        exit(1);
  12695.      }
  12696.  
  12697. 
  12698. File: libc.info,  Node: exp,  Next: exp10,  Prev: exit,  Up: Alphabetical List
  12699.  
  12700. exp
  12701. ===
  12702.  
  12703. Syntax
  12704. ------
  12705.  
  12706.      #include <math.h>
  12707.      
  12708.      double exp(double x);
  12709.  
  12710. Description
  12711. -----------
  12712.  
  12713. This function computes the exponential of X, e^x, where e is the base
  12714. of the natural system of logarithms, approximately 2.718281828.
  12715.  
  12716. Return Value
  12717. ------------
  12718.  
  12719. e to the X power.  If the value of X is finite, but so large in
  12720. magnitude that its exponential cannot be accurately represented by a
  12721. `double', the return value is the nearest representable `double'
  12722. (possibly, an `Inf'), and `errno' is set to `ERANGE'.  If X is either a
  12723. positive or a negative infinity, the result is either `+Inf' or zero,
  12724. respectively, and `errno' is not changed.  If X is a `NaN', the return
  12725. value is `NaN' and `errno' is set to `EDOM'.
  12726.  
  12727. Portability
  12728. -----------
  12729.  
  12730. ANSI, POSIX
  12731.  
  12732. 
  12733. File: libc.info,  Node: exp10,  Next: exp2,  Prev: exp,  Up: Alphabetical List
  12734.  
  12735. exp10
  12736. =====
  12737.  
  12738. Syntax
  12739. ------
  12740.  
  12741.      #include <math.h>
  12742.      
  12743.      double exp10(double x);
  12744.  
  12745. Description
  12746. -----------
  12747.  
  12748. This function computes 10 to the power of X, 10^x.
  12749.  
  12750. Return Value
  12751. ------------
  12752.  
  12753. 10 to the X power.  If the value of X is finite, but so large in
  12754. magnitude that 10^x cannot be accurately represented by a `double', the
  12755. return value is the nearest representable `double' (possibly, an
  12756. `Inf'), and `errno' is set to `ERANGE'.  If X is either a positive or a
  12757. negative infinity, the result is either `+Inf' or zero, respectively,
  12758. and `errno' is not changed.  If X is a `NaN', the return value is `NaN'
  12759. and `errno' is set to `EDOM'.
  12760.  
  12761. Portability
  12762. -----------
  12763.  
  12764. not ANSI, not POSIX
  12765.  
  12766. 
  12767. File: libc.info,  Node: exp2,  Next: expm1,  Prev: exp10,  Up: Alphabetical List
  12768.  
  12769. exp2
  12770. ====
  12771.  
  12772. Syntax
  12773. ------
  12774.  
  12775.      #include <math.h>
  12776.      
  12777.      double exp2(double x);
  12778.  
  12779. Description
  12780. -----------
  12781.  
  12782. This function computes 2 to the power of X, 2^x.
  12783.  
  12784. Return Value
  12785. ------------
  12786.  
  12787. 2 to the X power.  If the value of X is finite, but so large in
  12788. magnitude that 2^x cannot be accurately represented by a `double', the
  12789. return value is is the nearest representable `double' (possibly, an
  12790. `Inf'), and `errno' is set to `ERANGE'.  If X is either a positive or a
  12791. negative infinity, the result is either `+Inf' or zero, respectively,
  12792. and `errno' is not changed.  If X is a `NaN', the return value is `NaN'
  12793. and `errno' is set to `EDOM'.
  12794.  
  12795. Portability
  12796. -----------
  12797.  
  12798. not ANSI, not POSIX
  12799.  
  12800. 
  12801. File: libc.info,  Node: expm1,  Next: fabs,  Prev: exp2,  Up: Alphabetical List
  12802.  
  12803. expm1
  12804. =====
  12805.  
  12806. Syntax
  12807. ------
  12808.  
  12809.      #include <math.h>
  12810.      
  12811.      double expm1(double x);
  12812.  
  12813. Description
  12814. -----------
  12815.  
  12816. This function computes the value of e^x - 1, the exponential of X minus
  12817. 1, where e is the base of the natural system of logarithms,
  12818. approximately 2.718281828.  The result is more accurate than `exp(x) -
  12819. 1' for small values of X, where the latter method would lose many
  12820. significant digits.
  12821.  
  12822. Return Value
  12823. ------------
  12824.  
  12825. e raised to the power X, minus 1.  If the value of X is finite, but so
  12826. large that its exponent would overflow a `double', the return value is
  12827. `Inf', and `errno' is set to `ERANGE'.  If X is either a positive or a
  12828. negative infinity, the result is either `+Inf' or -1, respectively, and
  12829. `errno' is not changed.  If X is a `NaN', the return value is `NaN' and
  12830. `errno' is set to `EDOM'.
  12831.  
  12832. Portability
  12833. -----------
  12834.  
  12835. not ANSI, not POSIX
  12836.  
  12837. 
  12838. File: libc.info,  Node: fabs,  Next: _far*,  Prev: expm1,  Up: Alphabetical List
  12839.  
  12840. fabs
  12841. ====
  12842.  
  12843. Syntax
  12844. ------
  12845.  
  12846.      #include <math.h>
  12847.      
  12848.      double fabs(double x);
  12849.  
  12850. Description
  12851. -----------
  12852.  
  12853. This function computes the absolute value of its argument X.
  12854.  
  12855. Return Value
  12856. ------------
  12857.  
  12858. X if X is positive, else -X.  Note that in this context, +0.0 is
  12859. positive and -0.0 is negative.  Infinities and `NaN's are returned
  12860. unchanged, except for the sign.
  12861.  
  12862. Portability
  12863. -----------
  12864.  
  12865. ANSI, POSIX
  12866.  
  12867. 
  12868. File: libc.info,  Node: _far*,  Next: fclose,  Prev: fabs,  Up: Alphabetical List
  12869.  
  12870. _far*
  12871. =====
  12872.  
  12873. Syntax
  12874. ------
  12875.  
  12876.      #include <sys/farptr.h>
  12877.      
  12878.      unsigned char _farpeekb(unsigned short selector, unsigned long offset);
  12879.      unsigned short _farpeekw(unsigned short selector, unsigned long offset);
  12880.      unsigned long _farpeekl(unsigned short selector, unsigned long offset);
  12881.      
  12882.      void _farpokeb(unsigned short sel, unsigned long off, unsigned char val);
  12883.      void _farpokew(unsigned short sel, unsigned long off, unsigned short val);
  12884.      void _farpokel(unsigned short sel, unsigned long off, unsigned long val);
  12885.      
  12886.      void _farsetsel(unsigned short selector);
  12887.      unsigned short _fargetsel(void);
  12888.      
  12889.      void _farnspokeb(unsigned long offset, unsigned char value);
  12890.      void _farnspokew(unsigned long offset, unsigned short value);
  12891.      void _farnspokel(unsigned long offset, unsigned long value);
  12892.      
  12893.      unsigned char _farnspeekb(unsigned long offset);
  12894.      unsigned short _farnspeekw(unsigned long offset);
  12895.      unsigned long _farnspeekl(unsigned long offset);
  12896.  
  12897. Description
  12898. -----------
  12899.  
  12900. These functions provide the equivalent functionality of "far pointers"
  12901. to peek or poke an absolute memory addresses, even though gcc doesn't
  12902. understand the keyword "far".  They come in handy when you need to
  12903. access memory-mapped devices (like VGA) or some address in lower memory
  12904. returned by a real-mode service.  These functions are provided as
  12905. inline assembler functions, so when you optimize your program they
  12906. reduce to only a few opcodes (only one more than a regular memory
  12907. access), resulting in very optimal code.
  12908.  
  12909. The first two groups of functions take a SELECTOR and an OFFSET.  This
  12910. selector is *not* a dos segment.  If you want to access dos memory,
  12911. pass _go32_info_block.selector_for_linear_memory (or just _dos_ds) as
  12912. the selector, and seg*16+ofs as the offset.  For functions which poke
  12913. the memory, you should also provide the VALUE to put there.
  12914.  
  12915. The last two groups assume that you've used `_farsetsel' to specify the
  12916. selector.  You should avoid making any function calls between
  12917. `_farsetsel' and using these other functions, unless you're absolutely
  12918. sure that they won't modify that selector.  This allows you to optimize
  12919. loops by setting the selector once outside the loop, and using the
  12920. shorter functions within the loop.  You can use `_fargetsel' if you
  12921. want to temporary change the selector with `_farsetsel' and restore it
  12922. afterwards.
  12923.  
  12924. Return Value
  12925. ------------
  12926.  
  12927. Functions which peek the address return the value at given address.
  12928. `_fargetsel' returns the current selector.
  12929.  
  12930. Portability
  12931. -----------
  12932.  
  12933. not ANSI, not POSIX
  12934.  
  12935. 
  12936. File: libc.info,  Node: fclose,  Next: fcntl,  Prev: _far*,  Up: Alphabetical List
  12937.  
  12938. fclose
  12939. ======
  12940.  
  12941. Syntax
  12942. ------
  12943.  
  12944.      #include <stdio.h>
  12945.      
  12946.      int fclose(FILE *file);
  12947.  
  12948. Description
  12949. -----------
  12950.  
  12951. This function closes the given FILE.
  12952.  
  12953. Return Value
  12954. ------------
  12955.  
  12956. Zero on success, else `EOF'.
  12957.  
  12958. Portability
  12959. -----------
  12960.  
  12961. ANSI, POSIX
  12962.  
  12963. Example
  12964. -------
  12965.  
  12966.      FILE *f = fopen("data", "r");
  12967.      fprintf(f, "Hello\n");
  12968.      fclose(f);
  12969.  
  12970. 
  12971. File: libc.info,  Node: fcntl,  Next: fcvt,  Prev: fclose,  Up: Alphabetical List
  12972.  
  12973. fcntl
  12974. =====
  12975.  
  12976. Syntax
  12977. ------
  12978.  
  12979.      #include <fcntl.h>
  12980.      
  12981.      int fcntl (int fd, int cmd, ...);
  12982.  
  12983. Description
  12984. -----------
  12985.  
  12986. This function performs the operation specified by CMD on the file open
  12987. on handle FD.  The following operations are defined by the header
  12988. `fcntl.h':
  12989.  
  12990. `F_DUPFD'
  12991.      Returns a file handle that duplicates FD like `dup' does (*note
  12992.      dup::.), except that `fcntl' also makes sure the returned handle
  12993.      is the lowest available handle greater than or equal to the
  12994.      integer value of the third argument.
  12995.  
  12996. `F_GETFD'
  12997.      Get the `FD_CLOEXEC' close-on-exec (a.k.a. no-inherit) status of
  12998.      FD.  If the returned value has its least-significant bit set, the
  12999.      file will not be inherited by programs invoked by this process;
  13000.      otherwise, the file will remain open in the child processes.
  13001.  
  13002.      Note that only the first 20 handles can be passed to child
  13003.      processes by DOS/Windows; handles beyond that cannot be inherited.
  13004.      In addition, the stub loader of the child DJGPP program will
  13005.      forcibly close handles 19 and 18 (since otherwise it will be
  13006.      unable to read the COFF executable information and enter protected
  13007.      mode).  Therefore, the current implementation always returns 0 for
  13008.      handles below 18, meaning that all those handles are inherited,
  13009.      and `FD_CLOEXEC' for handles 18 and above.
  13010.  
  13011.      The no-inherit bit can be set when the file is open, by using the
  13012.      `O_NOINHERIT' in the open flags; see *Note open::.
  13013.  
  13014. `F_SETFD'
  13015.      Set the close-on-exec flag for the handle FD using the LSB of the
  13016.      integer value supplied as the third argument.  Currently, `fcntl'
  13017.      always fails this call and sets `errno' to `ENOSYS', since
  13018.      DOS/Windows don't support changing the no-inherit status of an open
  13019.      file.
  13020.  
  13021. `F_GETFL'
  13022.      Get the open mode and status flags associated with the handle FD.
  13023.      The flags are those supported by `open' and `creat' functions,
  13024.      like `O_READONLY', `O_APPEND', etc.  Currently, this command
  13025.      always returns zero, with no flags set.
  13026.  
  13027. `F_SETFL'
  13028.      Set the open mode and status flags associated with the handle FD.
  13029.      This always fails and sets `errno' to `ENOSYS', since DOS and
  13030.      Windows don't allow to change the descriptor flags after the file
  13031.      is open.
  13032.  
  13033. `F_GETLK'
  13034.      Get a description of a file segment lock as specified in the
  13035.      structure pointed to by the third argument.  This is unsupported
  13036.      and will always fail.
  13037.  
  13038. `F_SETLK'
  13039.      Set or clear a file segment lock according to the structure
  13040.      pointed to by the third argument.  This is unsupported and will
  13041.      always fail.
  13042.  
  13043. `F_SETLKW'
  13044.      Same as `F_SETLK', but if the lock is blocked, the call will wait
  13045.      until it is unblocked and the lock can be applied.  This is
  13046.      unsupported and will always fail.
  13047.  
  13048. This function can be hooked by the "Filesystem extensions", see *Note
  13049. File System Extensions::.  If you don't want this, and you are calling
  13050. `fcntl' with the `F_DUPFD' command, you should use `dup2' instead, see
  13051. *Note dup2::.
  13052.  
  13053. Return Value
  13054. ------------
  13055.  
  13056. If an invalid or unsupported value is passed in CMD, or FD is an
  13057. invalid file handle, the function returns -1 and sets `errno' to the
  13058. appropriate value.  Unsupported values of CMD cause `ENOSYS' to be
  13059. stored in `errno'.  If CMD is `F_DUPFD', the function returns the new
  13060. descriptor or -1 in case of a failure.
  13061.  
  13062. Portability
  13063. -----------
  13064.  
  13065. not ANSI, POSIX (see note 1)
  13066.  
  13067. Notes:
  13068.  
  13069.   1. Contrary to Posix requirement, the handle returned by `F_DUPFD'
  13070.      shares the `FD_CLOEXEC' flag with FD (unless they are on different
  13071.      sides of the 20-handle mark), since DOS/Windows only maintain a
  13072.      single set of bits for all the handles associated with the same
  13073.      call to `open'.
  13074.  
  13075. Example
  13076. -------
  13077.  
  13078.       /* Save the handle in a way that it won't be passed
  13079.          to child processes.  */
  13080.        int saved_fd = fcntl (fd, F_DUPFD, 20);
  13081.  
  13082. 
  13083. File: libc.info,  Node: fcvt,  Next: fcvtbuf,  Prev: fcntl,  Up: Alphabetical List
  13084.  
  13085. fcvt
  13086. ====
  13087.  
  13088. Syntax
  13089. ------
  13090.  
  13091.      #include <stdlib.h>
  13092.      
  13093.      char * fcvt (double value, int ndigits, int *decpt, int *sign)
  13094.  
  13095. Description
  13096. -----------
  13097.  
  13098. This function converts the VALUE into a null-terminated string, and
  13099. returns a pointer to that string.
  13100.  
  13101. `fcvt' works exactly like `fcvtbuf' (*note fcvtbuf::.), except that it
  13102. generates the string in an internal static buffer which is overwritten
  13103. on each call.
  13104.  
  13105. Return Value
  13106. ------------
  13107.  
  13108. A pointer to the generated string.
  13109.  
  13110. Portability
  13111. -----------
  13112.  
  13113. not ANSI, not POSIX
  13114.  
  13115. 
  13116. File: libc.info,  Node: fcvtbuf,  Next: fdopen,  Prev: fcvt,  Up: Alphabetical List
  13117.  
  13118. fcvtbuf
  13119. =======
  13120.  
  13121. Syntax
  13122. ------
  13123.  
  13124.      #include <stdlib.h>
  13125.      
  13126.      char * fcvtbuf (double value, int ndigits, int *decpt, int *sign, char *buf)
  13127.  
  13128. Description
  13129. -----------
  13130.  
  13131. This function converts its argument VALUE into a null-terminated string
  13132. in BUF with NDIGITS digits *to the right* of the decimal point.
  13133. NDIGITS can be negative to indicate rounding to the left of the decimal
  13134. point.  BUF should have enough space to hold at least
  13135. `310+max(0,NDIGITS)' characters.
  13136.  
  13137. Note that, unlike `ecvtbuf' (*note ecvtbuf::.), `fcvtbuf' only counts
  13138. the digits *to the right* of the decimal point.  Thus, if VALUE is
  13139. 123.45678 and NDIGITS is 4, then `ecvtbuf' will produce "1235", but
  13140. `fcvtbuf' will produce "1234568" (and *DECPT will be 3 in both cases).
  13141.  
  13142. The produced string in BUF does *not* include the decimal point.
  13143. Instead, the position of the decimal point relative to the beginning of
  13144. BUF is stored in an integer variable whose address is passed in DECPT.
  13145. Thus, if BUF is returned as "1234" and *DECPT as 1, this corresponds to
  13146. a value of 1.234; if *DECPT is -1, this corresponds to a value of
  13147. 0.01234, etc.
  13148.  
  13149. The sign is also not included in BUF's value.  If VALUE is negative,
  13150. `ecvtbuf' puts a nonzero value into the variable whose address is
  13151. passed in SIGN; otherwise it stores zero in *SIGN.
  13152.  
  13153. The least-significant digit in BUF is rounded.
  13154.  
  13155. `ecvtbuf' produces the string "NaN" if VALUE is a NaN, and "Inf" or
  13156. "Infinity" if VALUE is an infinity (the longer form is produced when
  13157. NDIGITS is 8 or more).
  13158.  
  13159. Return Value
  13160. ------------
  13161.  
  13162. A pointer to BUF.
  13163.  
  13164. Portability
  13165. -----------
  13166.  
  13167. not ANSI, not POSIX
  13168.  
  13169. Example
  13170. -------
  13171.  
  13172.        #include <stdlib.h>
  13173.        #include <stdio.h>
  13174.        #include <math.h>
  13175.      
  13176.        char vbuf[20];
  13177.        int fsign, fdecpt;
  13178.      
  13179.        fcvtbuf (M_PI, 5, &fdecpt, &fsign, buf)
  13180.        /* This will print " 314159".  */
  13181.        printf ("%c%s", fsign ? '-' : ' ', buf);
  13182.  
  13183. 
  13184. File: libc.info,  Node: fdopen,  Next: feof,  Prev: fcvtbuf,  Up: Alphabetical List
  13185.  
  13186. fdopen
  13187. ======
  13188.  
  13189. Syntax
  13190. ------
  13191.  
  13192.      #include <stdio.h>
  13193.      
  13194.      FILE *fdopen(int fd, const char *mode);
  13195.  
  13196. Description
  13197. -----------
  13198.  
  13199. This function opens a stream-type file that uses the given FD file,
  13200. which must already be open.  The file is opened with the modes
  13201. specified by MODE, which is the same as for `fopen'.  *Note fopen::.
  13202.  
  13203. Return Value
  13204. ------------
  13205.  
  13206. The newly created `FILE *', or `NULL' on error.
  13207.  
  13208. Portability
  13209. -----------
  13210.  
  13211. not ANSI, POSIX
  13212.  
  13213. Example
  13214. -------
  13215.  
  13216.      FILE *stdprn = fdopen(4, "w");
  13217.  
  13218. 
  13219. File: libc.info,  Node: feof,  Next: ferror,  Prev: fdopen,  Up: Alphabetical List
  13220.  
  13221. feof
  13222. ====
  13223.  
  13224. Syntax
  13225. ------
  13226.  
  13227.      #include <stdio.h>
  13228.      
  13229.      int feof(FILE *file);
  13230.  
  13231. Description
  13232. -----------
  13233.  
  13234. This function can be used to indicate if the given FILE is at the
  13235. end-of-file or not.
  13236.  
  13237. Return Value
  13238. ------------
  13239.  
  13240. Nonzero at end-of-file, zero otherwise.
  13241.  
  13242. Portability
  13243. -----------
  13244.  
  13245. ANSI, POSIX
  13246.  
  13247. Example
  13248. -------
  13249.  
  13250.      while (!feof(stdin))
  13251.        gets(line);
  13252.  
  13253. 
  13254. File: libc.info,  Node: ferror,  Next: fflush,  Prev: feof,  Up: Alphabetical List
  13255.  
  13256. ferror
  13257. ======
  13258.  
  13259. Syntax
  13260. ------
  13261.  
  13262.      #include <stdio.h>
  13263.      
  13264.      int ferror(FILE *file);
  13265.  
  13266. Description
  13267. -----------
  13268.  
  13269. This function can be used to indicate if the given FILE has encountered
  13270. an error or not.  *Note clearerr::.
  13271.  
  13272. Return Value
  13273. ------------
  13274.  
  13275. Nonzero for an error, zero otherwize.
  13276.  
  13277. Portability
  13278. -----------
  13279.  
  13280. ANSI, POSIX
  13281.  
  13282. Example
  13283. -------
  13284.  
  13285.      if (ferror(stdin))
  13286.        exit(1);
  13287.  
  13288. 
  13289. File: libc.info,  Node: fflush,  Next: ffs,  Prev: ferror,  Up: Alphabetical List
  13290.  
  13291. fflush
  13292. ======
  13293.  
  13294. Syntax
  13295. ------
  13296.  
  13297.      #include <stdio.h>
  13298.      
  13299.      int fflush(FILE *file);
  13300.  
  13301. Description
  13302. -----------
  13303.  
  13304. If FILE is not a `NULL' pointer, this function causes any unwritten
  13305. buffered data to be written out to the given FILE.  This is useful in
  13306. cases where the output is line buffered and you want to write a partial
  13307. line.
  13308.  
  13309. If FILE is a `NULL' pointer, `fflush' writes any buffered output to all
  13310. files opened for output.
  13311.  
  13312. Note that `fflush' has no effect for streams opened for reading only.
  13313. Also note that the operating system can further buffer/cache writes to
  13314. disk files; a call to `fsync' (*note fsync::.) or `sync' (*note
  13315. sync::.) is typically required to actually deliver data to the file(s).
  13316.  
  13317. Return Value
  13318. ------------
  13319.  
  13320. Zero on success, -1 on error.  When called with a `NULL' pointer, -1
  13321. will be returned if an error happened while flushing some of the
  13322. streams (but `fflush' will still try to flush all the rest before it
  13323. returns).
  13324.  
  13325. Portability
  13326. -----------
  13327.  
  13328. ANSI, POSIX
  13329.  
  13330. Example
  13331. -------
  13332.  
  13333.      printf("Enter value : ");
  13334.      fflush(stdout);
  13335.      scanf(result);
  13336.  
  13337. 
  13338. File: libc.info,  Node: ffs,  Next: fgetc,  Prev: fflush,  Up: Alphabetical List
  13339.  
  13340. ffs
  13341. ===
  13342.  
  13343. Syntax
  13344. ------
  13345.  
  13346.      #include <string.h>
  13347.      
  13348.      int ffs(int _mask);
  13349.  
  13350. Description
  13351. -----------
  13352.  
  13353. This function find the first (least significant) bit set in the input
  13354. value.
  13355.  
  13356. Return Value
  13357. ------------
  13358.  
  13359. Bit position (1..32) of the least significant set bit, or zero if the
  13360. input value is zero.
  13361.  
  13362. Portability
  13363. -----------
  13364.  
  13365. not ANSI, not POSIX
  13366.  
  13367. Example
  13368. -------
  13369.  
  13370.      ffs(0) = 0
  13371.      ffs(1) = 1
  13372.      ffs(5) = 1
  13373.      ffs(96) = 6
  13374.  
  13375. 
  13376. File: libc.info,  Node: fgetc,  Next: fgetgrent,  Prev: ffs,  Up: Alphabetical List
  13377.  
  13378. fgetc
  13379. =====
  13380.  
  13381. Syntax
  13382. ------
  13383.  
  13384.      #include <stdio.h>
  13385.      
  13386.      int fgetc(FILE *file);
  13387.  
  13388. Description
  13389. -----------
  13390.  
  13391. Returns the next character in the given FILE as an unsigned char.
  13392.  
  13393. Return Value
  13394. ------------
  13395.  
  13396. The given char (value 0..255) or `EOF' at end-of-file.
  13397.  
  13398. Portability
  13399. -----------
  13400.  
  13401. ANSI, POSIX
  13402.  
  13403. Example
  13404. -------
  13405.  
  13406.      int c;
  13407.      while((c=fgetc(stdin)) != EOF)
  13408.        fputc(c, stdout);
  13409.  
  13410. 
  13411. File: libc.info,  Node: fgetgrent,  Next: fgetpos,  Prev: fgetc,  Up: Alphabetical List
  13412.  
  13413. fgetgrent
  13414. =========
  13415.  
  13416. Syntax
  13417. ------
  13418.  
  13419.      #include <grp.h>
  13420.      
  13421.      struct group *fgetgrent(FILE *file);
  13422.  
  13423. Description
  13424. -----------
  13425.  
  13426. This function, in MS-DOS, is exactly the same as `getgrent' (*note
  13427. getgrent::.).
  13428.  
  13429. Portability
  13430. -----------
  13431.  
  13432. not ANSI, not POSIX
  13433.  
  13434. 
  13435. File: libc.info,  Node: fgetpos,  Next: fgets,  Prev: fgetgrent,  Up: Alphabetical List
  13436.  
  13437. fgetpos
  13438. =======
  13439.  
  13440. Syntax
  13441. ------
  13442.  
  13443.      #include <stdio.h>
  13444.      
  13445.      int fgetpos(FILE *file, fpos_t *offset);
  13446.  
  13447. Description
  13448. -----------
  13449.  
  13450. This function records the current file pointer for FILE, for later use
  13451. by `fsetpos'.
  13452.  
  13453. *Note fsetpos::.  *Note ftell::.
  13454.  
  13455. Return Value
  13456. ------------
  13457.  
  13458. Zero if successful, nonzero if not.
  13459.  
  13460. Portability
  13461. -----------
  13462.  
  13463. ANSI, POSIX
  13464.  
  13465. 
  13466. File: libc.info,  Node: fgets,  Next: File System Extensions,  Prev: fgetpos,  Up: Alphabetical List
  13467.  
  13468. fgets
  13469. =====
  13470.  
  13471. Syntax
  13472. ------
  13473.  
  13474.      #include <stdio.h>
  13475.      
  13476.      char *fgets(char *buffer, int maxlength, FILE *file);
  13477.  
  13478. Description
  13479. -----------
  13480.  
  13481. This function reads as much of a line from a file as possible, stopping
  13482. when the buffer is full (MAXLENGTH-1 characters), an end-of-line is
  13483. detected, or `EOF' or an error is detected.  It then stores a `NULL' to
  13484. terminate the string.
  13485.  
  13486. Return Value
  13487. ------------
  13488.  
  13489. The address of the buffer is returned on success, if `EOF' is
  13490. encountered before any characters are stored, or if an error is
  13491. detected, `NULL' is returned instead.
  13492.  
  13493. Portability
  13494. -----------
  13495.  
  13496. ANSI, POSIX
  13497.  
  13498. Example
  13499. -------
  13500.  
  13501.      char buf[100];
  13502.      while (fgets(buf, 100, stdin))
  13503.        fputs(buf, stdout);
  13504.  
  13505. 
  13506. File: libc.info,  Node: File System Extensions,  Next: __file_exists,  Prev: fgets,  Up: Alphabetical List
  13507.  
  13508. File System Extensions
  13509. ======================
  13510.  
  13511. Description
  13512. -----------
  13513.  
  13514. The File System Extensions are a part of the lowest level of I/O
  13515. operations in the C runtime library of DJGPP.  These extensions are
  13516. provided to allow for cases where Unix uses a file descriptor to access
  13517. such items as serial ports, memory, and the network, but DOS does not.
  13518. It allows a set of functions (called an extension) to gain control when
  13519. one of these low-level functions is called on a file descriptor set up
  13520. by the extension.
  13521.  
  13522. Each extension must provide one or two handler functions.  All handler
  13523. functions take the same arguments:
  13524.  
  13525.        int function(__FSEXT_Fnumber func_number, int *rv, va_list args);
  13526.  
  13527. The FUNC_NUMBER identifies which function is to be emulated.  The file
  13528. `<sys/fsext.h>' defines the function numbers as follows:
  13529.  
  13530. `__FSEXT_nop'
  13531.      A no-op.  This is currently unused by the library functions.
  13532.  
  13533. `__FSEXT_open'
  13534.      An open handler.  This is called just before the library is about
  13535.      to issue the DOS OpenFile call on behalf of your program.
  13536.  
  13537. `__FSEXT_creat'
  13538.      A create handler.  Called when a file needs to be created.  Note
  13539.      that the handler should both create the "file" and open it.
  13540.  
  13541. `__FSEXT_read'
  13542.      A read handler.  Called when data should be read from a "file".
  13543.  
  13544. `__FSEXT_write'
  13545.      A write handler.  Called to write data to a "file".  On "text"
  13546.      files it receives the ORIGINAL (unconverted) buffer.
  13547.  
  13548. `__FSEXT_ready'
  13549.      A ready handler.  It is called by `select' library function (*note
  13550.      select::.) when it needs to know whether a handle used to
  13551.      reference the "file" is ready for reading or writing, or has an
  13552.      error condition set.  The handler should return an OR'ed bit mask
  13553.      of the following bits (defined on `<sys/fsext.h>'):
  13554.  
  13555.     `__FSEXT_ready_read'
  13556.           The "file" is ready for reading.
  13557.  
  13558.     `__FSEXT_ready_write'
  13559.           The "file" is ready for writing.
  13560.  
  13561.     `__FSEXT_ready_error'
  13562.           The "file" has an error condition set.
  13563.  
  13564. `__FSEXT_close'
  13565.      A close handler.  Called when the "file" should be closed.
  13566.  
  13567. `__FSEXT_fcntl'
  13568.      A file fcntl handler.
  13569.  
  13570. `__FSEXT_ioctl'
  13571.      A file ioctl handler.
  13572.  
  13573. `__FSEXT_lseek'
  13574.      A file lseek handler (*note lseek::.).
  13575.  
  13576. `__FSEXT_link'
  13577.      A file link handler (*note link::.).  This is most relevant to file
  13578.      system extensions that emulate a directory structure.
  13579.  
  13580. `__FSEXT_unlink'
  13581.      A file unlink handler (*note unlink::.).  This is most relevant to
  13582.      file system extensions that emulate a directory structure.
  13583.  
  13584. `__FSEXT_dup'
  13585.      A file dup handler (*note dup::.).  This is called when a new
  13586.      descriptor is needed to refer to an existing descriptor.
  13587.  
  13588. `__FSEXT_dup2'
  13589.      A file dup2 handler (*note dup2::.).  This is called when two
  13590.      different file descriptors are used to refer to the same open file.
  13591.  
  13592. `__FSEXT_fstat'
  13593.      A file fstat handler (*note fstat::.).  The extension should fill
  13594.      in various status information about the emulated file.
  13595.  
  13596. RV points to a temporary return value pointer.  If the function is
  13597. emulated by the handler, the return value should be stored here, and the
  13598. handler should return a nonzero value.  If the handler returns zero, it
  13599. is assumed to have not emulated the call, and the regular DOS I/O
  13600. function will happen.  The ARGS represent the arguments passed to the
  13601. original function; these point to the actual arguments on the stack, so
  13602. the emulation may choose to modify them and return zero to the regular
  13603. function, which will then act on the modified arguments.
  13604.  
  13605. A normal extension would provide these parts:
  13606.  
  13607.    *  Some function to create a connection to the extension.  This may
  13608.      be a custom function (such as `socket' for networking) or an
  13609.      extension to open (such as `/dev/ttyS0' to access the serial port).
  13610.  
  13611.    *  Initialization code that adds the open handler, if any.
  13612.  
  13613.    *  Overrides for the basic I/O functions, such as `read' and
  13614.      `write'.  This is a single function in the extension that uses the
  13615.      function number parameter to select an extension function.
  13616.  
  13617.    *  The core functionality of the extension, if any.
  13618.  
  13619. Please note that the special Unix filenames `/dev/null' and `/dev/tty'
  13620. are already mapped to the appropriate DOS names `NUL' and `CON',
  13621. respectively, so you don't need to write extensions for these.
  13622.  
  13623. 
  13624. File: libc.info,  Node: __file_exists,  Next: __file_tree_walk,  Prev: File System Extensions,  Up: Alphabetical List
  13625.  
  13626. __file_exists
  13627. =============
  13628.  
  13629. Syntax
  13630. ------
  13631.  
  13632.      #include <unistd.h>
  13633.      
  13634.      int __file_exists(const char *_fn);
  13635.  
  13636. Description
  13637. -----------
  13638.  
  13639. This function provides a fast way to ask if a given file exists.
  13640. Unlike access(), this function does not cause other objects to get
  13641. linked in with your program, so is used primarily by the startup code
  13642. to keep minimum code size small.
  13643.  
  13644. Return Value
  13645. ------------
  13646.  
  13647. Zero if the file does not exist, nonzero if it does.  Note that this is
  13648. the opposite of what access() returns.
  13649.  
  13650. Portability
  13651. -----------
  13652.  
  13653. not ANSI, not POSIX
  13654.  
  13655. Example
  13656. -------
  13657.  
  13658.  
  13659.      if (__file_exists(fname))
  13660.        process_file(fname);
  13661.  
  13662. 
  13663. File: libc.info,  Node: __file_tree_walk,  Next: filelength,  Prev: __file_exists,  Up: Alphabetical List
  13664.  
  13665. __file_tree_walk
  13666. ================
  13667.  
  13668. Syntax
  13669. ------
  13670.  
  13671.      #include <dir.h>
  13672.      
  13673.      int __file_tree_walk(const char *dir,
  13674.                         int (*func)(const char *path, const struct ffblk *ff));
  13675.  
  13676. Description
  13677. -----------
  13678.  
  13679. This function recursively descends the directory hierarchy which starts
  13680. with DIR.  For each file in the hierarchy, `__file_tree_walk' calls the
  13681. user-defined function FUNC which is passed a pointer to a
  13682. `NULL'-terminated character array in PATH holding the full pathname of
  13683. the file, a pointer to a `ffblk' structure (*note findfirst::.) FF with
  13684. a DOS filesystem information about that file.
  13685.  
  13686. This function always visits a directory before any of its siblings.  The
  13687. argument DIR must be a directory, or `__file_tree_walk' will fail and
  13688. set ERRNO to `ENOTDIR'.  The directory DIR itself is never passed to
  13689. FUNC.
  13690.  
  13691. The tree traversal continues until one of the following events:
  13692.  
  13693. (1)  The tree is exhausted (i.e., all descendants of DIR are
  13694. processed).  In this case, `__file_tree_walk' returns 0, meaning a
  13695. success.
  13696.  
  13697. (2)  An invocation of FUNC returns a non-zero value.  In this case,
  13698. `__file_tree_walk' stops the tree traversal and returns whatever FUNC
  13699. returned.
  13700.  
  13701. (3)  An error is detected within `__file_tree_walk'.  In that case,
  13702. `ftw' returns -1 and sets ERRNO (*note errno::.) to a suitable value.
  13703.  
  13704. Return Value
  13705. ------------
  13706.  
  13707. Zero in case the entire tree was successfully traversed, -1 if
  13708. `__file_tree_walk' detected some error during its operation, or any
  13709. other non-zero value which was returned by the user-defined function
  13710. FUNC.
  13711.  
  13712. Portability
  13713. -----------
  13714.  
  13715. not ANSI, not POSIX
  13716.  
  13717. Example
  13718. -------
  13719.  
  13720.      #include <stdlib.h>
  13721.      
  13722.      int
  13723.      ff_walker(const char *path, const struct ffblk *ff)
  13724.      {
  13725.        printf("%s:\t%lu\t", path, ff->ff_fsize);
  13726.        if (ff->ff_attrib & 1)
  13727.          printf("R");
  13728.        if (ff->ff_attrib & 2)
  13729.          printf("H");
  13730.        if (ff->ff_attrib & 4)
  13731.          printf("S");
  13732.        if (ff->ff_attrib & 8)
  13733.          printf("V");
  13734.        if (ff->ff_attrib & 0x10)
  13735.          printf("D");
  13736.        if (ff->ff_attrib & 0x20)
  13737.          printf("A");
  13738.        printf("\n");
  13739.      
  13740.        if (strcmp(ff->ff_name, "XXXXX") == 0)
  13741.          return 42;
  13742.        return 0;
  13743.      }
  13744.      
  13745.      int
  13746.      main(int argc, char *argv[])
  13747.      {
  13748.        if (argc > 1)
  13749.          {
  13750.            char msg[80];
  13751.      
  13752.            sprintf(msg, "__file_tree_walk: %d",
  13753.                         __file_tree_walk(argv[1], ff_walker));
  13754.            if (errno)
  13755.              perror(msg);
  13756.            else
  13757.              puts(msg);
  13758.          }
  13759.        else
  13760.          printf("Usage: %s dir\n", argv[0]);
  13761.      
  13762.        return 0;
  13763.      }
  13764.  
  13765. 
  13766. File: libc.info,  Node: filelength,  Next: fileno,  Prev: __file_tree_walk,  Up: Alphabetical List
  13767.  
  13768. filelength
  13769. ==========
  13770.  
  13771. Syntax
  13772. ------
  13773.  
  13774.      #include <io.h>
  13775.      
  13776.      long filelength(int fhandle);
  13777.  
  13778. Description
  13779. -----------
  13780.  
  13781. This function returns the size, in bytes, of a file whose handle is
  13782. specified in the argument FHANDLE.  To get the handle of a file opened
  13783. by *Note fopen:: or *Note freopen::, you can use *Note fileno:: macro.
  13784.  
  13785. Return Value
  13786. ------------
  13787.  
  13788. The size of the file in bytes, or (if any error occured) -1L and ERRNO
  13789. set to a value describing the cause of the failure.
  13790.  
  13791. Portability
  13792. -----------
  13793.  
  13794. not ANSI, not POSIX
  13795.  
  13796. Example
  13797. -------
  13798.  
  13799.        printf("Size of file to which STDIN is redirected is %ld\n",
  13800.                filelength(0));
  13801.  
  13802. 
  13803. File: libc.info,  Node: fileno,  Next: findfirst,  Prev: filelength,  Up: Alphabetical List
  13804.  
  13805. fileno
  13806. ======
  13807.  
  13808. Syntax
  13809. ------
  13810.  
  13811.      #include <stdio.h>
  13812.      
  13813.      int fileno(FILE *file);
  13814.  
  13815. Description
  13816. -----------
  13817.  
  13818. This function returns the raw file descriptor number that FILE uses for
  13819. I/O.
  13820.  
  13821. Return Value
  13822. ------------
  13823.  
  13824. The file descriptor number.
  13825.  
  13826. Portability
  13827. -----------
  13828.  
  13829. not ANSI, POSIX
  13830.  
  13831. 
  13832. File: libc.info,  Node: findfirst,  Next: findnext,  Prev: fileno,  Up: Alphabetical List
  13833.  
  13834. findfirst
  13835. =========
  13836.  
  13837. Syntax
  13838. ------
  13839.  
  13840.      #include <dir.h>
  13841.      
  13842.      int findfirst(const char *pathname, struct ffblk *ffblk, int attrib);
  13843.  
  13844. Description
  13845. -----------
  13846.  
  13847. This function and the related `findnext' (*note findnext::.) are used
  13848. to scan directories for the list of files therein.  The PATHNAME is a
  13849. wildcard that specifies the directory and files to search for (such as
  13850. `subdir/*.c'), FFBLK is a structure to hold the results and state of
  13851. the search, and ATTRIB is a combination of the following:
  13852.  
  13853. `FA_RDONLY'
  13854.      Include read-only files in the search (Ignored.)
  13855.  
  13856. `FA_HIDDEN'
  13857.      Include hidden files in the search
  13858.  
  13859. `FA_SYSTEM'
  13860.      Include system files in the search
  13861.  
  13862. `FA_LABEL'
  13863.      Include the volume label in the search
  13864.  
  13865. `FA_DIREC'
  13866.      Include subdirectories in the search
  13867.  
  13868. `FA_ARCH'
  13869.      Include modified files in the search (Ignored.)
  13870.  
  13871. If a file has flag bits that are not specified in the ATTRIB parameter,
  13872. the file will be excluded from the results.  Thus, if you specified
  13873. `FA_DIREC' and `FA_LABEL', subdirectories and the volume label will be
  13874. included in the results.  Hidden and system files will be excluded.
  13875.  
  13876. Since `findfirst' calls DOS function 4eh, it is not possible to exclude
  13877. read-only files or archive files from the results.  Even if the FA_ARCH
  13878. and FA_RDONLY bits are not specified in the attrib parameter, the
  13879. results will include any read-only and archive files in the directory
  13880. searched.
  13881.  
  13882. This function supports long file names.
  13883.  
  13884. The results of the search are stored in FFBLK, which is extended when
  13885. the LFN API (*note LFN: _use_lfn.) is supported.  Fields marked LFN are
  13886. only valid if the `lfn_magic' member is set to "LFN32".
  13887.  
  13888.      struct ffblk {
  13889.        char lfn_magic[6];        /* LFN: the magic "LFN32" signature */
  13890.        short lfn_handle;        /* LFN: the handle used by findfirst/findnext */
  13891.        unsigned short lfn_ctime; /* LFN: file creation time */
  13892.        unsigned short lfn_cdate; /* LFN: file creation date */
  13893.        unsigned short lfn_atime; /* LFN: file last access time (usually 0) */
  13894.        unsigned short lfn_adate; /* LFN: file last access date */
  13895.        char ff_reserved[5];      /* used to hold the state of the search */
  13896.        unsigned char ff_attrib;  /* actual attributes of the file found */
  13897.        unsigned short ff_ftime;  /* hours:5, minutes:6, (seconds/2):5 */
  13898.        unsigned short ff_fdate;  /* (year-1980):7, month:4, day:5 */
  13899.        unsigned long ff_fsize;   /* size of file */
  13900.        char ff_name[260];        /* name of file as ASCIIZ string */
  13901.      }
  13902.  
  13903. Return Value
  13904. ------------
  13905.  
  13906. Zero if a match is found, nonzero if none found.
  13907.  
  13908. Portability
  13909. -----------
  13910.  
  13911. not ANSI, not POSIX
  13912.  
  13913. Example
  13914. -------
  13915.  
  13916.      struct ffblk f;
  13917.      int done = findfirst("*.exe", &f, FA_HIDDEN | FA_SYSTEM);
  13918.      while (!done)
  13919.      {
  13920.        printf("%10u %2u:%02u:%02u %2u/%02u/%4u %s\n",
  13921.          f.ff_fsize,
  13922.          (f.ff_ftime >> 11) & 0x1f,
  13923.          (f.ff_ftime >>  5) & 0x3f,
  13924.          (f.ff_ftime & 0x1f) * 2,
  13925.          (f.ff_fdate >>  5) & 0x0f,
  13926.          (f.ff_fdate & 0x1f),
  13927.          ((f.ff_fdate >> 9) & 0x7f) + 1980,
  13928.          f.ff_name);
  13929.        done = findnext(&f);
  13930.      }
  13931.  
  13932. 
  13933. File: libc.info,  Node: findnext,  Next: _fixpath,  Prev: findfirst,  Up: Alphabetical List
  13934.  
  13935. findnext
  13936. ========
  13937.  
  13938. Syntax
  13939. ------
  13940.  
  13941.      #include <dir.h>
  13942.      
  13943.      int findnext(struct ffblk *ffblk);
  13944.  
  13945. Description
  13946. -----------
  13947.  
  13948. This finds the next file in the search started by `findfirst'.  *Note
  13949. findfirst::.
  13950.  
  13951. Return Value
  13952. ------------
  13953.  
  13954. Zero if there was a match, else nonzero.
  13955.  
  13956. Portability
  13957. -----------
  13958.  
  13959. not ANSI, not POSIX
  13960.  
  13961. 
  13962. File: libc.info,  Node: _fixpath,  Next: floor,  Prev: findnext,  Up: Alphabetical List
  13963.  
  13964. _fixpath
  13965. ========
  13966.  
  13967. Syntax
  13968. ------
  13969.  
  13970.      #include <sys/stat.h>
  13971.      
  13972.      void _fixpath(const char *in_path, char *out_path);
  13973.  
  13974. Description
  13975. -----------
  13976.  
  13977. This function canonicalizes the input path IN_PATH and stores the
  13978. result in the buffer pointed to by OUT_PATH.
  13979.  
  13980. The path is fixed by removing consecutive and trailing slashes, making
  13981. the path absolute if it's relative by prepending the current drive
  13982. letter and working directory, removing "." components, collapsing ".."
  13983. components, adding a drive specifier if needed, and converting all
  13984. slashes to '/'.  DOS-style 8+3 names of directories which are part of
  13985. the pathname, as well as its final filename part, are returned
  13986. lower-cased in OUT_PATH, but long filenames are left intact.  *Note
  13987. _preserve_fncase::, for more details on letter-case conversions in
  13988. filenames.
  13989.  
  13990. Since the returned path name can be longer than the original one, the
  13991. caller should ensure there is enough space in the buffer pointed to by
  13992. OUT_PATH.  Using ANSI-standard constant `FILENAME_MAX' (defined on
  13993. `stdio.h') or Posix-standard constant `PATH_MAX' (defined on
  13994. `limits.h') is recommended.
  13995.  
  13996. Return Value
  13997. ------------
  13998.  
  13999. None.
  14000.  
  14001. Portability
  14002. -----------
  14003.  
  14004. not ANSI, not POSIX
  14005.  
  14006. Example
  14007. -------
  14008.  
  14009.      char oldpath[100], newpath[FILENAME_MAX];
  14010.      scanf(oldpath);
  14011.      _fixpath(oldpath, newpath);
  14012.      printf("that really is %s\n", newpath);
  14013.  
  14014. 
  14015. File: libc.info,  Node: floor,  Next: _flush_disk_cache,  Prev: _fixpath,  Up: Alphabetical List
  14016.  
  14017. floor
  14018. =====
  14019.  
  14020. Syntax
  14021. ------
  14022.  
  14023.      #include <math.h>
  14024.      
  14025.      double floor(double x);
  14026.  
  14027. Description
  14028. -----------
  14029.  
  14030. This function computes the largest integer not greater than X.
  14031.  
  14032. Return Value
  14033. ------------
  14034.  
  14035. The largest integer value less than or equal to X.  Infinities and
  14036. `NaN's are returned unchanged.
  14037.  
  14038. Portability
  14039. -----------
  14040.  
  14041. ANSI, POSIX
  14042.  
  14043. 
  14044. File: libc.info,  Node: _flush_disk_cache,  Next: fmod,  Prev: floor,  Up: Alphabetical List
  14045.  
  14046. _flush_disk_cache
  14047. =================
  14048.  
  14049. Syntax
  14050. ------
  14051.  
  14052.      #include <io.h>
  14053.      
  14054.      void _flush_disk_cache (void);
  14055.  
  14056. Description
  14057. -----------
  14058.  
  14059. Attempts to update the disk with the data cached in the write-behind
  14060. disk caches (such as `SmartDrv' and the built-in Windows 95 disk cache).
  14061.  
  14062. Note that this does *not* flushes the DOS buffers.  You need to call
  14063. `fsync' (*note fsync::.) or `close' (*note close::.) to force DOS to
  14064. commit the file data to the disk; `sync' (*note sync::.) does that for
  14065. all open files.
  14066.  
  14067. Return Value
  14068. ------------
  14069.  
  14070. None.
  14071.  
  14072. Portability
  14073. -----------
  14074.  
  14075. not ANSI, not POSIX
  14076.  
  14077. Example
  14078. -------
  14079.  
  14080.        /* Make sure all files are actually written to disk.  */
  14081.        sync ();
  14082.        _flush_disk_cache ();
  14083.  
  14084. 
  14085. File: libc.info,  Node: fmod,  Next: _fmode,  Prev: _flush_disk_cache,  Up: Alphabetical List
  14086.  
  14087. fmod
  14088. ====
  14089.  
  14090. Syntax
  14091. ------
  14092.  
  14093.      #include <math.h>
  14094.      
  14095.      double fmod(double x, double y);
  14096.  
  14097. Description
  14098. -----------
  14099.  
  14100. This function computes the remainder of `X/Y', which is X - iY for some
  14101. integer i such that iY < X < (i+1)Y.
  14102.  
  14103. Return Value
  14104. ------------
  14105.  
  14106. The remainder of X/Y.  If X is `Inf' or `NaN', the return value is
  14107. `NaN' and `errno' is set to `EDOM'.  If Y is zero, the return value is
  14108. zero (but `errno' is not changed).
  14109.  
  14110. Portability
  14111. -----------
  14112.  
  14113. ANSI, POSIX
  14114.  
  14115. 
  14116. File: libc.info,  Node: _fmode,  Next: fnmatch,  Prev: fmod,  Up: Alphabetical List
  14117.  
  14118. _fmode
  14119. ======
  14120.  
  14121. Syntax
  14122. ------
  14123.  
  14124.      #include <fcntl.h>
  14125.      
  14126.      extern int _fmode;
  14127.  
  14128. Description
  14129. -----------
  14130.  
  14131. This variable may be set to `O_TEXT' or `O_BINARY' to specify the mode
  14132. that newly opened files should be opened in if the open call did not
  14133. specify.  *Note open::. *Note fopen::.
  14134.  
  14135. The default value is `O_TEXT'.
  14136.  
  14137. Portability
  14138. -----------
  14139.  
  14140. not ANSI, not POSIX
  14141.  
  14142. Example
  14143. -------
  14144.  
  14145.      _fmode = O_BINARY;
  14146.  
  14147. 
  14148. File: libc.info,  Node: fnmatch,  Next: fnmerge,  Prev: _fmode,  Up: Alphabetical List
  14149.  
  14150. fnmatch
  14151. =======
  14152.  
  14153. Syntax
  14154. ------
  14155.  
  14156.      #include <fnmatch.h>
  14157.      
  14158.      int fnmatch(const char *pattern, const char *string, int flags);
  14159.  
  14160. Description
  14161. -----------
  14162.  
  14163. This function indicates if STRING matches the PATTERN.  The PATTERN may
  14164. include the following special characters:
  14165.  
  14166. `*'
  14167.      Matches zero of more characters.
  14168.  
  14169. `?'
  14170.      Matches exactly one character.
  14171.  
  14172. `[...]'
  14173.      Matches one character if it's in a range of characters.  If the
  14174.      first character is `!', matches if the character is not in the
  14175.      range.  Between the brackets, the range is specified by listing
  14176.      the characters that are in the range, or two characters separated
  14177.      by `-' to indicate all characters in that range.  For example,
  14178.      `[a-d]' matches `a', `b', `c', or `d'.  If you want to include the
  14179.      literal `-' in the range, make it the first character, like in
  14180.      `[-afz]'.
  14181.  
  14182. `\'
  14183.      Causes the next character to not be treated as a wildcard.  For
  14184.      example, `\*' matches an asterisk.  This feature is not available
  14185.      if FLAGS includes `FNM_NOESCAPE', in which case `\' is treated as
  14186.      a directory separator.
  14187.  
  14188. The value of FLAGS is a combination of zero of more of the following:
  14189.  
  14190. `FNM_PATHNAME'
  14191.      This means that the STRING should be treated as a pathname, in
  14192.      that the slash characters `/' and `\' in STRING never match any of
  14193.      the wildcards in PATTERN.
  14194.  
  14195. `FNM_NOESCAPE'
  14196.      If this flag is *not* set, the backslash `\' may be used in
  14197.      PATTERN for quoting special characters.  If this flag *is* set,
  14198.      `\' is treated as a directory separator.
  14199.  
  14200. `FNM_NOCASE'
  14201.      If this flag is set, `fnmatch' matches characters
  14202.      case-insensitively, including in character ranges like `[a-f]'.
  14203.      Note that the case-folding is done by calling `toupper' (*note
  14204.      toupper::.), and thus might be sensitive to the current locale.
  14205.  
  14206. `FNM_PERIOD'
  14207.      This flag is accepted and ignored in the current implementation.
  14208.      (This is the right thing to do on non-LFN platforms, where leading
  14209.      dots in file names are forbidden.)
  14210.  
  14211.      In the Posix specification, if this flag is set, leading dots in
  14212.      file names will not match any wildcards.  If `FNM_PATHNAME' is
  14213.      set, a dot after a slash also doesn't match any wildcards.
  14214.  
  14215. The DJGPP implementation treats forward slashes and backslashes as equal
  14216. when `FNM_NOESCAPE' is set, since on DOS/Windows these two characters
  14217. are both used as directory separators in file names.
  14218.  
  14219. Return Value
  14220. ------------
  14221.  
  14222. Zero if the string matches, `FNM_NOMATCH' if it does not.  Posix
  14223. defines an additional `FNM_ERROR' code that's returned in case of an
  14224. error, but the current implementation never returns it.
  14225.  
  14226. Portability
  14227. -----------
  14228.  
  14229. not ANSI, POSIX (see note 1)
  14230.  
  14231. Notes:
  14232.  
  14233.   1. The equal handling of `\' and `/' is DJGPP-specific.
  14234.  
  14235. Example
  14236. -------
  14237.  
  14238.      if (fnmatch("*.[ch]", filename, FNM_PATHNAME|FNM_NOCASE))
  14239.        do_source_file(filename);
  14240.  
  14241. 
  14242. File: libc.info,  Node: fnmerge,  Next: fnsplit,  Prev: fnmatch,  Up: Alphabetical List
  14243.  
  14244. fnmerge
  14245. =======
  14246.  
  14247. Syntax
  14248. ------
  14249.  
  14250.      #include <dir.h>
  14251.      
  14252.      void fnmerge (char *path, const char *drive, const char *dir,
  14253.              const char *name, const char *ext);
  14254.  
  14255. Description
  14256. -----------
  14257.  
  14258. This function constructs a file PATH from its components DRIVE, DIR,
  14259. NAME, and EXT.  If any of these is a `NULL' pointer, it won't be used.
  14260. Usually, the DRIVE string should include the trailing colon ``:'', the
  14261. DIR string should include the trailing slash ``/'' or backslash ``\'',
  14262. and the EXT string should include the leading dot ``.''.  However, if
  14263. any of these isn't present, `fnmerge' will add them.
  14264.  
  14265. *Note fnsplit::.
  14266.  
  14267. Return Value
  14268. ------------
  14269.  
  14270. None.
  14271.  
  14272. Portability
  14273. -----------
  14274.  
  14275. not ANSI, not POSIX
  14276.  
  14277. Example
  14278. -------
  14279.  
  14280.      char buf[MAXPATH];
  14281.      fnmerge(buf, "d:", "/foo/", "data", ".txt");
  14282.  
  14283. 
  14284. File: libc.info,  Node: fnsplit,  Next: fopen,  Prev: fnmerge,  Up: Alphabetical List
  14285.  
  14286. fnsplit
  14287. =======
  14288.  
  14289. Syntax
  14290. ------
  14291.  
  14292.      #include <dir.h>
  14293.      
  14294.      int fnsplit (const char *path, char *drive, char *dir,
  14295.              char *name, char *ext);
  14296.  
  14297. Description
  14298. -----------
  14299.  
  14300. This function decomposes a PATH into its components.  It is smart
  14301. enough to know that `.' and `..' are directories, and that file names
  14302. with a leading dot, like `.emacs', are not all extensions.
  14303.  
  14304. The DRIVE, DIR, NAME and EXT arguments should all be passed, but some
  14305. or even all of them might be `NULL' pointers.  Those of them which are
  14306. non-`NULL' should point to buffers which have enough room for the
  14307. strings they would hold.  The constants `MAXDRIVE', `MAXDIR', `MAXFILE'
  14308. and `MAXEXT', defined on dir.h, define the maximum length of these
  14309. buffers.
  14310.  
  14311. *Note fnmerge::.
  14312.  
  14313. Return Value
  14314. ------------
  14315.  
  14316. A flag that indicates which components were found:
  14317.  
  14318. `DRIVE'
  14319.      The drive letter was found.
  14320.  
  14321. `DIRECTORY'
  14322.      A directory or subdirectories was found.
  14323.  
  14324. `FILENAME'
  14325.      A filename was found.
  14326.  
  14327. `EXTENSION'
  14328.      An extension was found.
  14329.  
  14330. `WILDCARDS'
  14331.      The path included `*' or `?'.
  14332.  
  14333. Portability
  14334. -----------
  14335.  
  14336. not ANSI, not POSIX
  14337.  
  14338. Example
  14339. -------
  14340.  
  14341.      char d[MAXDRIVE], p[MAXDIR], f[MAXFILE], e[MAXEXT];
  14342.      int which = fnsplit("d:/djgpp/bin/gcc.exe", d, p, f, e);
  14343.      d = "d:"
  14344.      p = "/djgpp/bin/"
  14345.      f = "gcc"
  14346.      e = ".exe"
  14347.  
  14348. 
  14349. File: libc.info,  Node: fopen,  Next: fork,  Prev: fnsplit,  Up: Alphabetical List
  14350.  
  14351. fopen
  14352. =====
  14353.  
  14354. Syntax
  14355. ------
  14356.  
  14357.      #include <stdio.h>
  14358.      
  14359.      FILE *fopen(const char *filename, const char *mode);
  14360.  
  14361. Description
  14362. -----------
  14363.  
  14364. This function opens a stream corresponding to the named FILENAME with
  14365. the given MODE.  The mode can be one of the following:
  14366.  
  14367. `r'
  14368.      Open an existing file for reading.
  14369.  
  14370. `w'
  14371.      Create a new file (or truncate an existing file) and open it for
  14372.      writing.
  14373.  
  14374. `a'
  14375.      Open an existing file (or create a new one) for writing.  The file
  14376.      pointer is positioned to the end of the file before every write.
  14377.  
  14378. Followed by any of these characters:
  14379.  
  14380. `b'
  14381.      Force the file to be open in binary mode instead of the default
  14382.      mode.
  14383.  
  14384.      When called to open the console in binary mode, `fopen' will
  14385.      disable the generation of `SIGINT' when you press `Ctrl-C'
  14386.      (`Ctrl-Break' will still cause `SIGINT'), because many programs
  14387.      that use binary reads from the console will also want to get the
  14388.      `^C' characters.  You can use the `__djgpp_set_ctrl_c' library
  14389.      function (*note __djgpp_set_ctrl_c::.) if you want `Ctrl-C' to
  14390.      generate interrupts while console is read in binary mode.
  14391.  
  14392. `t'
  14393.      Force the file to be open in text mode instead of the default mode.
  14394.  
  14395. `+'
  14396.      Open the file as with `O_RDWR' so that both reads and writes can
  14397.      be done to the same file.
  14398.  
  14399. If the file is open for both reading and writing, you must call
  14400. `fflush', `fseek', or `rewind' before switching from read to write or
  14401. from write to read.
  14402.  
  14403. The open file is set to line buffered if the underlying object is a
  14404. device (stdin, stdout, etc), or is fully buffered if the underlying
  14405. object is a disk file (data.c, etc).
  14406.  
  14407. If `b' or `t' is not specified in MODE, the file type is chosen by the
  14408. value of `fmode' (*note _fmode::.).
  14409.  
  14410. If you need to specify the DOS share flags use the
  14411. `__djgpp_share_flags'.  *Note __djgpp_share_flags::.
  14412.  
  14413. Return Value
  14414. ------------
  14415.  
  14416. A pointer to the `FILE' object, or `NULL' if there was an error.
  14417.  
  14418. Portability
  14419. -----------
  14420.  
  14421. ANSI, POSIX
  14422.  
  14423. Example
  14424. -------
  14425.  
  14426.      FILE *f = fopen("foo", "rb+"); /* open existing file for read/write, binary mode */
  14427.  
  14428. 
  14429. File: libc.info,  Node: fork,  Next: fpathconf,  Prev: fopen,  Up: Alphabetical List
  14430.  
  14431. fork
  14432. ====
  14433.  
  14434. Syntax
  14435. ------
  14436.  
  14437.      #include <unistd.h>
  14438.      
  14439.      pid_t fork(void);
  14440.  
  14441. Description
  14442. -----------
  14443.  
  14444. This function always returns -1 and sets `errno' to ENOMEM, as MS-DOS
  14445. does not support multiple processes.  It exists only to assist in
  14446. porting Unix programs.
  14447.  
  14448. Portability
  14449. -----------
  14450.  
  14451. not ANSI, POSIX
  14452.  
  14453. 
  14454. File: libc.info,  Node: fpathconf,  Next: _fpreset,  Prev: fork,  Up: Alphabetical List
  14455.  
  14456. fpathconf
  14457. =========
  14458.  
  14459. Syntax
  14460. ------
  14461.  
  14462.      #include <unistd.h>
  14463.      
  14464.      long fpathconf(int fd, int name);
  14465.  
  14466. Description
  14467. -----------
  14468.  
  14469. Returns configuration information on the filesystem that the open file
  14470. resides on.  *Note pathconf::.  If the filesystem cannot be determined
  14471. from the file handle FD (e.g., for character devices), `fpathconf' will
  14472. return the info for the current drive.
  14473.  
  14474. Return Value
  14475. ------------
  14476.  
  14477. The configuration value; for details, see *Note pathconf::.
  14478.  
  14479. Portability
  14480. -----------
  14481.  
  14482. not ANSI, POSIX
  14483.  
  14484. 
  14485. File: libc.info,  Node: _fpreset,  Next: fprintf,  Prev: fpathconf,  Up: Alphabetical List
  14486.  
  14487. _fpreset
  14488. ========
  14489.  
  14490. Syntax
  14491. ------
  14492.  
  14493.      #include <float.h>
  14494.      
  14495.      void _fpreset(void);
  14496.  
  14497. Description
  14498. -----------
  14499.  
  14500. Resets the FPU completely.
  14501.  
  14502. Portability
  14503. -----------
  14504.  
  14505. not ANSI, not POSIX
  14506.  
  14507. 
  14508. File: libc.info,  Node: fprintf,  Next: fpurge,  Prev: _fpreset,  Up: Alphabetical List
  14509.  
  14510. fprintf
  14511. =======
  14512.  
  14513. Syntax
  14514. ------
  14515.  
  14516.      #include <stdio.h>
  14517.      
  14518.      int fprintf(FILE *file, const char *format, ...);
  14519.  
  14520. Description
  14521. -----------
  14522.  
  14523. Prints formatted output to the named file.  *Note printf::.
  14524.  
  14525. Return Value
  14526. ------------
  14527.  
  14528. The number of characters written.
  14529.  
  14530. Portability
  14531. -----------
  14532.  
  14533. ANSI, POSIX
  14534.  
  14535. 
  14536. File: libc.info,  Node: fpurge,  Next: fputc,  Prev: fprintf,  Up: Alphabetical List
  14537.  
  14538. fpurge
  14539. ======
  14540.  
  14541. Syntax
  14542. ------
  14543.  
  14544.      #include <stdio.h>
  14545.      
  14546.      int fpurge(FILE *file);
  14547.  
  14548. Description
  14549. -----------
  14550.  
  14551. If FILE designates a buffered stream open for writing or for both
  14552. reading and writing, this function purges the stream's buffer without
  14553. writing it to disk.  Otherwise, it does nothing (so it has no effect on
  14554. read-only streams such as `stdin').
  14555.  
  14556. Return Value
  14557. ------------
  14558.  
  14559. Zero on success, -1 on failure.
  14560.  
  14561. Portability
  14562. -----------
  14563.  
  14564. not ANSI, not POSIX
  14565.  
  14566. 
  14567. File: libc.info,  Node: fputc,  Next: fputs,  Prev: fpurge,  Up: Alphabetical List
  14568.  
  14569. fputc
  14570. =====
  14571.  
  14572. Syntax
  14573. ------
  14574.  
  14575.      #include <stdio.h>
  14576.      
  14577.      int fputc(int character, FILE *file);
  14578.  
  14579. Description
  14580. -----------
  14581.  
  14582. This function writes the given CHARACTER to the given `file'.
  14583.  
  14584. Return Value
  14585. ------------
  14586.  
  14587. The given character [0..255] or `EOF'.
  14588.  
  14589. Portability
  14590. -----------
  14591.  
  14592. ANSI, POSIX
  14593.  
  14594. Example
  14595. -------
  14596.  
  14597.      fputc('\n', stdout);
  14598.  
  14599. 
  14600. File: libc.info,  Node: fputs,  Next: fread,  Prev: fputc,  Up: Alphabetical List
  14601.  
  14602. fputs
  14603. =====
  14604.  
  14605. Syntax
  14606. ------
  14607.  
  14608.      #include <stdio.h>
  14609.      
  14610.      int fputs(const char *string, FILE *file);
  14611.  
  14612. Description
  14613. -----------
  14614.  
  14615. This function all the characters of STRING (except the trailing `NULL')
  14616. to the given FILE.
  14617.  
  14618. Return Value
  14619. ------------
  14620.  
  14621. A nonnegative number on success, `EOF' on error.
  14622.  
  14623. Portability
  14624. -----------
  14625.  
  14626. ANSI, POSIX
  14627.  
  14628. Example
  14629. -------
  14630.  
  14631.      fputs("Hello\n", stdout);
  14632.  
  14633. 
  14634. File: libc.info,  Node: fread,  Next: free,  Prev: fputs,  Up: Alphabetical List
  14635.  
  14636. fread
  14637. =====
  14638.  
  14639. Syntax
  14640. ------
  14641.  
  14642.      #include <stdio.h>
  14643.      
  14644.      size_t fread(void *buffer, size_t size, size_t number, FILE *file);
  14645.  
  14646. Description
  14647. -----------
  14648.  
  14649. This function reads SIZE*NUMBER characters from FILE to BUFFER.
  14650.  
  14651. Return Value
  14652. ------------
  14653.  
  14654. The number of items of size SIZE read, or less if there was an error.
  14655.  
  14656. Portability
  14657. -----------
  14658.  
  14659. ANSI, POSIX
  14660.  
  14661. Example
  14662. -------
  14663.  
  14664.      int foo[10];
  14665.      fread(foo, sizeof(int), 10, stdin);
  14666.  
  14667. 
  14668. File: libc.info,  Node: free,  Next: freopen,  Prev: fread,  Up: Alphabetical List
  14669.  
  14670. free
  14671. ====
  14672.  
  14673. Syntax
  14674. ------
  14675.  
  14676.      #include <stdlib.h>
  14677.      
  14678.      void free(void *ptr);
  14679.  
  14680. Description
  14681. -----------
  14682.  
  14683. Returns the allocated memory to the heap (*note malloc::.).  If the PTR
  14684. is `NULL', it does nothing.
  14685.  
  14686. Return Value
  14687. ------------
  14688.  
  14689. None.
  14690.  
  14691. Portability
  14692. -----------
  14693.  
  14694. ANSI, POSIX
  14695.  
  14696. Example
  14697. -------
  14698.  
  14699.      char *q = (char *)malloc(20);
  14700.      free(q);
  14701.  
  14702. 
  14703. File: libc.info,  Node: freopen,  Next: frexp,  Prev: free,  Up: Alphabetical List
  14704.  
  14705. freopen
  14706. =======
  14707.  
  14708. Syntax
  14709. ------
  14710.  
  14711.      #include <stdio.h>
  14712.      
  14713.      FILE *freopen(const char *filename, const char *mode, FILE *file);
  14714.  
  14715. Description
  14716. -----------
  14717.  
  14718. This function closes FILE if it was open, then opens a new file like
  14719. `fopen(filename, mode)' but it reuses FILE.
  14720.  
  14721. This is useful to, for example, associate `stdout' with a new file.
  14722.  
  14723. Return Value
  14724. ------------
  14725.  
  14726. The new file, or `NULL' on error.
  14727.  
  14728. Portability
  14729. -----------
  14730.  
  14731. ANSI, POSIX
  14732.  
  14733. Example
  14734. -------
  14735.  
  14736.      freopen("/tmp/stdout.dat", "wb", stdout);
  14737.  
  14738. 
  14739. File: libc.info,  Node: frexp,  Next: fscanf,  Prev: freopen,  Up: Alphabetical List
  14740.  
  14741. frexp
  14742. =====
  14743.  
  14744. Syntax
  14745. ------
  14746.  
  14747.      #include <math.h>
  14748.      
  14749.      double frexp(double x, int *pexp);
  14750.  
  14751. Description
  14752. -----------
  14753.  
  14754. This function separates the given value X into a mantissa m in the
  14755. range `[0.5,1)' and an exponent e, such that m*2^e = X.  It returns the
  14756. value of the mantissa and stores the integer exponent in *PEXP.
  14757.  
  14758. Return Value
  14759. ------------
  14760.  
  14761. The mantissa.  If the value of X is `NaN' or `Inf', the return value is
  14762. `NaN', zero is stored in `*pexp', and `errno' is set to `EDOM'.  If X
  14763. is zero, *PEXP and the return value are also both zero.
  14764.  
  14765. Portability
  14766. -----------
  14767.  
  14768. ANSI, POSIX
  14769.  
  14770. 
  14771. File: libc.info,  Node: fscanf,  Next: fseek,  Prev: frexp,  Up: Alphabetical List
  14772.  
  14773. fscanf
  14774. ======
  14775.  
  14776. Syntax
  14777. ------
  14778.  
  14779.      #include <stdio.h>
  14780.      
  14781.      int fscanf(FILE *file, const char *format, ...);
  14782.  
  14783. Description
  14784. -----------
  14785.  
  14786. This function scans formatted text from FILE and stores it in the
  14787. variables pointed to by the arguments.  *Note scanf::.
  14788.  
  14789. Return Value
  14790. ------------
  14791.  
  14792. The number of items successfully scanned.
  14793.  
  14794. Portability
  14795. -----------
  14796.  
  14797. ANSI, POSIX
  14798.  
  14799. 
  14800. File: libc.info,  Node: fseek,  Next: fsetpos,  Prev: fscanf,  Up: Alphabetical List
  14801.  
  14802. fseek
  14803. =====
  14804.  
  14805. Syntax
  14806. ------
  14807.  
  14808.      #include <stdio.h>
  14809.      
  14810.      int fseek(FILE *file, long offset, int mode);
  14811.  
  14812. Description
  14813. -----------
  14814.  
  14815. This function moves the file pointer for FILE according to MODE:
  14816.  
  14817. `SEEK_SET'
  14818.      The file pointer is moved to the offset specified.
  14819.  
  14820. `SEEK_CUR'
  14821.      The file pointer is moved relative to its current position.
  14822.  
  14823. `SEEK_END'
  14824.      The file pointer is moved to a position OFFSET bytes from the end
  14825.      of the file.  The offset is usually nonpositive in this case.
  14826.  
  14827. *Warning!* The ANSI standard only allows values of zero for OFFSET when
  14828. MODE is not `SEEK_SET' and the file has been opened as a text file.
  14829. Although this restriction is not enforced, beware that there is not a
  14830. one-to-one correspondence between file characters and text characters
  14831. under MS-DOS, so some `fseek' operations may not do exactly what you
  14832. expect.
  14833.  
  14834. Also, since `lseek' under DOS does not return an error indication when
  14835. you try to move the file pointer before the beginning of the file,
  14836. neither will `fseek'.  Portable programs should call `ftell' after
  14837. `fseek' to get the actual position of the file pointer.
  14838.  
  14839. Note that DOS does not mind if you seek before the beginning of the
  14840. file, like seeking from the end of the file by more than the file's
  14841. size.  Therefore, `lseek' will not return with an error in such cases
  14842. either.
  14843.  
  14844. Return Value
  14845. ------------
  14846.  
  14847. Zero if successful, nonzero if not.
  14848.  
  14849. Portability
  14850. -----------
  14851.  
  14852. ANSI, POSIX
  14853.  
  14854. Example
  14855. -------
  14856.  
  14857.      fseek(stdin, 12, SEEK_CUR); /* skip 12 bytes */
  14858.  
  14859. 
  14860. File: libc.info,  Node: fsetpos,  Next: __FSEXT_add_open_handler,  Prev: fseek,  Up: Alphabetical List
  14861.  
  14862. fsetpos
  14863. =======
  14864.  
  14865. Syntax
  14866. ------
  14867.  
  14868.      #include <stdio.h>
  14869.      
  14870.      int fsetpos(FILE *file, const fpos_t *offset);
  14871.  
  14872. Description
  14873. -----------
  14874.  
  14875. This function moves the file pointer for FILE to position OFFSET, as
  14876. recorded by `fgetpos'.
  14877.  
  14878. *Note fgetpos::.  *Note fseek::.
  14879.  
  14880. Return Value
  14881. ------------
  14882.  
  14883. Zero if successful, nonzero if not.
  14884.  
  14885. Portability
  14886. -----------
  14887.  
  14888. ANSI, POSIX
  14889.  
  14890. 
  14891. File: libc.info,  Node: __FSEXT_add_open_handler,  Next: __FSEXT_alloc_fd,  Prev: fsetpos,  Up: Alphabetical List
  14892.  
  14893. __FSEXT_add_open_handler
  14894. ========================
  14895.  
  14896. Syntax
  14897. ------
  14898.  
  14899.      #include <sys/fsext.h>
  14900.      
  14901.      int __FSEXT_add_open_handler(__FSEXT_Function *_function);
  14902.  
  14903. Description
  14904. -----------
  14905.  
  14906. This function is part of the *Note File System Extensions::.  It is used
  14907. to add a handler for functions that do not get passed descriptors, such
  14908. as `_open' and `_creat'.
  14909.  
  14910. Portability
  14911. -----------
  14912.  
  14913. not ANSI, not POSIX
  14914.  
  14915. Example
  14916. -------
  14917.  
  14918.      static int
  14919.      _my_handler(__FSEXT_Fnumber n, int *rv, va_list args)
  14920.      {
  14921.        . . .
  14922.      }
  14923.      
  14924.      int main()
  14925.      {
  14926.        __FSEXT_add_open_handler(_my_handler);
  14927.      }
  14928.  
  14929. 
  14930. File: libc.info,  Node: __FSEXT_alloc_fd,  Next: __FSEXT_call_open_handlers,  Prev: __FSEXT_add_open_handler,  Up: Alphabetical List
  14931.  
  14932. __FSEXT_alloc_fd
  14933. ================
  14934.  
  14935. Syntax
  14936. ------
  14937.  
  14938.      #include <sys/fsext.h>
  14939.      
  14940.      int __FSEXT_alloc_fd(__FSEXT_Function *_function);
  14941.  
  14942. Description
  14943. -----------
  14944.  
  14945. This function is part of the *Note File System Extensions::.  It is used
  14946. by extensions that fully emulate the I/O functions, and thus don't have
  14947. a corresponding DOS file handle.  Upon the first call, this function
  14948. opens DOS's `NUL' device, so as to allocate a handle that DOS won't
  14949. then reuse.  Upon subsequent calls, that handle is duplicated by
  14950. calling the DOS `dup' function; this makes all of the handles use a
  14951. single entry in the System File Table, and thus be independent of what
  14952. the `FILES=' parameter of `CONFIG.SYS' says.  `__FSEXT_alloc_fd' also
  14953. assigns the handler function for the handle it returns.
  14954.  
  14955. The module is responsible for calling `_close' on the descriptor after
  14956. setting the handler function to zero in the extended close handler.
  14957.  
  14958. Return Value
  14959. ------------
  14960.  
  14961. If successful, a new file descriptor is returned. On error, a negative
  14962. number is returned and ERRNO is set to indicate the error.
  14963.  
  14964. Portability
  14965. -----------
  14966.  
  14967. not ANSI, not POSIX
  14968.  
  14969. Example
  14970. -------
  14971.  
  14972.  
  14973.      int socket()
  14974.      {
  14975.        int fd = __FSEXT_alloc_fd(socket_handler);
  14976.        init_socket(fd);
  14977.        return fd;
  14978.      }
  14979.  
  14980. 
  14981. File: libc.info,  Node: __FSEXT_call_open_handlers,  Next: __FSEXT_get_data,  Prev: __FSEXT_alloc_fd,  Up: Alphabetical List
  14982.  
  14983. __FSEXT_call_open_handlers
  14984. ==========================
  14985.  
  14986. Syntax
  14987. ------
  14988.  
  14989.      #include <sys/fsext.h>
  14990.      
  14991.      int __FSEXT_call_open_handlers(__FSEXT_Fnumber _function_number,
  14992.                         int *rv, va_list _args);
  14993.  
  14994. Description
  14995. -----------
  14996.  
  14997. This function is part of the *Note File System Extensions::.  It is used
  14998. internally to libc.a to allow extensions to get an opportunity to
  14999. override the `_open' and `_creat' functions.
  15000.  
  15001. Portability
  15002. -----------
  15003.  
  15004. not ANSI, not POSIX
  15005.  
  15006. 
  15007. File: libc.info,  Node: __FSEXT_get_data,  Next: __FSEXT_get_function,  Prev: __FSEXT_call_open_handlers,  Up: Alphabetical List
  15008.  
  15009. __FSEXT_get_data
  15010. ================
  15011.  
  15012. Syntax
  15013. ------
  15014.  
  15015.      #include <sys/fsext.h>
  15016.      
  15017.      void *__FSEXT_get_data(int _fd);
  15018.  
  15019. Description
  15020. -----------
  15021.  
  15022. This function is part of the *Note File System Extensions::.  It is used
  15023. to retrieve a descriptor-specific pointer that was previously stored by
  15024. `__FSEXT_set_data' (*note __FSEXT_set_data::.).  The pointer is not
  15025. otherwise used.
  15026.  
  15027. *Note __FSEXT_set_data::, for an example of how this may be used.
  15028.  
  15029. Return Value
  15030. ------------
  15031.  
  15032. Returns the stored pointer, or NULL if there was an error (or no
  15033. pointer had been stored).
  15034.  
  15035. Portability
  15036. -----------
  15037.  
  15038. not ANSI, not POSIX
  15039.  
  15040. 
  15041. File: libc.info,  Node: __FSEXT_get_function,  Next: __FSEXT_set_data,  Prev: __FSEXT_get_data,  Up: Alphabetical List
  15042.  
  15043. __FSEXT_get_function
  15044. ====================
  15045.  
  15046. Syntax
  15047. ------
  15048.  
  15049.      #include <sys/fsext.h>
  15050.      
  15051.      __FSEXT_Function *__FSEXT_get_function(int _fd);
  15052.  
  15053. This function is part of the *Note File System Extensions::.  It is used
  15054. internal to libc.a to redirect I/O requests to the appropriate
  15055. extensions.
  15056.  
  15057. Portability
  15058. -----------
  15059.  
  15060. not ANSI, not POSIX
  15061.  
  15062. Example
  15063. -------
  15064.  
  15065.      _read(int fd, void *buf, int len)
  15066.      {
  15067.        __FSEXT_Function *func = __FSEXT_get_function(fd);
  15068.        if (func)
  15069.        {
  15070.          int rv;
  15071.          if (func(__FSEXT_read, &rv, &fd))
  15072.            return rv;
  15073.        }
  15074.        /* rest of read() */
  15075.      }
  15076.  
  15077. 
  15078. File: libc.info,  Node: __FSEXT_set_data,  Next: __FSEXT_set_function,  Prev: __FSEXT_get_function,  Up: Alphabetical List
  15079.  
  15080. __FSEXT_set_data
  15081. ================
  15082.  
  15083. Syntax
  15084. ------
  15085.  
  15086.      #include <sys/fsext.h>
  15087.      
  15088.      void * __FSEXT_set_data(int _fd, void *_data);
  15089.  
  15090. Description
  15091. -----------
  15092.  
  15093. This function is part of the *Note File System Extensions::.  It is used
  15094. to store a descriptor-specific pointer that can later be retrieved by
  15095. `__FSEXT_get_data' (*note __FSEXT_get_data::.).  The pointer is not
  15096. otherwise used.
  15097.  
  15098. This is useful when writing an extension that may be handling several
  15099. open pseudo-files.  `__FSEXT_set_data' can be used when creating or
  15100. opening the file to store a pointer to data about the specific file.
  15101. Later, when specific operation needs to be done (e.g. read, write,
  15102. etc.) a pointer to pseudo-file associated with the file descriptor can
  15103. be fetched with `__FSEXT_get_data'.
  15104.  
  15105. Return Value
  15106. ------------
  15107.  
  15108. Returns the pointer you passed it, or NULL if there was an error.
  15109.  
  15110. Portability
  15111. -----------
  15112.  
  15113. not ANSI, not POSIX
  15114.  
  15115. Example
  15116. -------
  15117.  
  15118.      typedef struct
  15119.      {
  15120.         void* Ptr;
  15121.         off_t Current_Ofs;
  15122.         size_t Size;
  15123.      } _mem_file_t;
  15124.      
  15125.      int my_fsext(__FSEXT_Fnumber Op, int* RV, va_list Args)
  15126.      {
  15127.         const char* Path;
  15128.         void* Buffer;
  15129.         size_t Size;
  15130.         int fd;
  15131.         _mem_file_t* MPtr;
  15132.      
  15133.         switch (Op)
  15134.         {
  15135.            case __FSEXT_creat:
  15136.             /* Create a new memory file */
  15137.      
  15138.             Path = va_list(Args, const char*);
  15139.      
  15140.             /* Check to see if we should create a new file */
  15141.             if (strnicmp("/tmp/", Path, 5) != 0) return 0;
  15142.      
  15143.             /* Allocate some memory to keep info on our fake file */
  15144.             MPtr = malloc(sizeof(_mem_file_t));
  15145.             if (!MPtr) return 0;
  15146.      
  15147.             memset(MPtr, 0, sizeof(_mem_file_t));
  15148.      
  15149.             /* Get a file descriptor we can use */
  15150.             fd = __FSEXT_alloc_fd(my_fsext);
  15151.             if (fd < 0)
  15152.             {
  15153.                free(MPtr);
  15154.                return 0;
  15155.             }
  15156.      
  15157.             /* Now store our note about this file descriptor so we can lookup it
  15158.                up quickly later. */
  15159.             __FSEXT_set_data(fd, MPtr);
  15160.      
  15161.             /* Return the file descriptor
  15162.             *RV = fd;
  15163.             return 1;
  15164.      
  15165.            case __FSEXT_read:
  15166.             /* Read from our memory file. */
  15167.             fd = va_list(Args, int);
  15168.             Buffer = va_list(Args, void*);
  15169.             Size = va_list(Args, size_t);
  15170.      
  15171.             /* Look up the information about this file */
  15172.             MPtr = __FSEXT_get_data(fd);
  15173.             if (!MPtr)
  15174.             {
  15175.                 *RV = -1;
  15176.                 return 1;
  15177.             }
  15178.      
  15179.             if (MPtr->Current_Ofs >= MPtr->Size)
  15180.             {
  15181.                 *RV = 0;
  15182.                 return 1;
  15183.             }
  15184.      
  15185.             if (Size > (MPtr->Size - MPtr->Current_Ofs))
  15186.              Size = MPtr->Size - MPtr->Current_Ofs;
  15187.      
  15188.             memcpy(Buffer, (char*) MPtr->Ptr+MPtr->Current_Ofs, Size);
  15189.             MPtr->Current_Ofs += Size;
  15190.      
  15191.             *RV = Size;
  15192.             return 1;
  15193.      
  15194.             ...
  15195.          }
  15196.      }
  15197.  
  15198. 
  15199. File: libc.info,  Node: __FSEXT_set_function,  Next: fstat,  Prev: __FSEXT_set_data,  Up: Alphabetical List
  15200.  
  15201. __FSEXT_set_function
  15202. ====================
  15203.  
  15204. Syntax
  15205. ------
  15206.  
  15207.      #include <sys/fsext.h>
  15208.      
  15209.      int __FSEXT_set_function(int _fd, __FSEXT_Function *_function);
  15210.  
  15211. Description
  15212. -----------
  15213.  
  15214. This function is part of the *Note File System Extensions::.  It is used
  15215. to set the handler function for those extensions that use DOS files for
  15216. I/O.  One situation where you might need this is when you must catch
  15217. output to the terminal and play some tricks with it, like colorize it or
  15218. redirect it to another device.
  15219.  
  15220. Return Value
  15221. ------------
  15222.  
  15223. Zero in case of success, non-zero in case of failure (like if _FD is
  15224. negative).
  15225.  
  15226. Portability
  15227. -----------
  15228.  
  15229. not ANSI, not POSIX
  15230.  
  15231. Example
  15232. -------
  15233.  
  15234.  
  15235.      #include <sys/fsext.h>
  15236.      #include <conio.h>
  15237.      
  15238.      /* A simple example of a write handler which converts DOS I/O to the
  15239.         screen into direct writes to video RAM.  */
  15240.      static int
  15241.      my_screen_write (__FSEXT_Fnumber func, int *retval, va_list rest_args)
  15242.      {
  15243.        char *buf, *mybuf;
  15244.        size_t buflen;
  15245.        int fd = va_arg (rest_args, int);
  15246.      
  15247.        if (func != __FSEXT_write || !isatty (fd))
  15248.          return 0;  /* and the usual DOS call will be issued */
  15249.      
  15250.        buf = va_arg (rest_args, char *);
  15251.        buflen = va_arg (rest_args, size_t);
  15252.        mybuf = alloca (buflen + 1);
  15253.        memcpy (mybuf, buf, buflen);
  15254.        mybuf[buflen] = '\0';
  15255.        cputs (mybuf);
  15256.        *retval = buflen;
  15257.        return 1;  /* meaning that we handled the call */
  15258.      }
  15259.      
  15260.      /* Install our handler.  The `attribute constructor' causes this
  15261.         function to be called by the startup code.  */
  15262.      static void __attribute__((constructor))
  15263.      install_screen_write_handler (void)
  15264.      {
  15265.        __FSEXT_set_function (fileno (stdout), my_screen_write);
  15266.      }
  15267.  
  15268. 
  15269. File: libc.info,  Node: fstat,  Next: fsync,  Prev: __FSEXT_set_function,  Up: Alphabetical List
  15270.  
  15271. fstat
  15272. =====
  15273.  
  15274. Syntax
  15275. ------
  15276.  
  15277.      #include <sys/stat.h>
  15278.      
  15279.      int fstat(int file, struct stat *sbuf);
  15280.  
  15281. Description
  15282. -----------
  15283.  
  15284. This function obtains the status of the open file FILE and stores it in
  15285. SBUF.  *Note stat::, for the description of members of `struct stat'.
  15286.  
  15287. Some members of `struct stat' are very expensive to compute.  If your
  15288. application is a heavy user of `fstat' and is too slow, you can disable
  15289. computation of the members your application doesn't need, as described
  15290. in *Note _djstat_flags::.
  15291.  
  15292. Return Value
  15293. ------------
  15294.  
  15295. Zero on success, nonzero on failure (and ERRNO set).
  15296.  
  15297. Portability
  15298. -----------
  15299.  
  15300. not ANSI, POSIX
  15301.  
  15302. Example
  15303. -------
  15304.  
  15305.      struct stat s;
  15306.      fstat(fileno(stdin), &s);
  15307.      if (S_ISREG(s.st_mode))
  15308.        puts("STDIN is a redirected disk file");
  15309.      else if (S_ISCHR(s.st_mode))
  15310.        puts("STDIN is a character device");
  15311.  
  15312. Bugs
  15313. ----
  15314.  
  15315. If a file was open in write-only mode, its execute mode bits might be
  15316. incorrectly reported as if the file were non-executable.  This is
  15317. because some executables are only recognized by reading their first two
  15318. bytes, which cannot be done for files open in write-only mode.
  15319.  
  15320. For `fstat' to return correct info, you should make sure that all the
  15321. data written to the file has been delivered to the operating system,
  15322. e.g. by calling both `fflush' and `fsync'.  Otherwise, the buffering of
  15323. the library I/O functions and the OS might cause stale info to be
  15324. returned.
  15325.  
  15326. Implementation Notes
  15327. --------------------
  15328.  
  15329. Supplying a 100% Unix-compatible `fstat' function under DOS is an
  15330. implementation nightmare.  The following notes describe some of the
  15331. obscure points specific to `fstat's behavior in DJGPP.
  15332.  
  15333. 1. The `drive' for character devices (like `con', `/dev/null' and
  15334. others is returned as -1.  For drives networked by Novell Netware, it
  15335. is returned as -2.
  15336.  
  15337. 2. The starting cluster number of a file serves as its inode number.
  15338. For files whose starting cluster number is inaccessible (empty files,
  15339. files on networked drives, etc.) the `st_inode' field will be `invented'
  15340. in a way which guarantees that no two different files will get the same
  15341. inode number (thus it is unique).  This invented inode will also be
  15342. different from any real cluster number of any local file.  However, only
  15343. for local, non-empty files/directories the inode is guaranteed to be
  15344. consistent between `stat' and `fstat' function calls.
  15345.  
  15346. 3. The WRITE access mode bit is set only for the user (unless the file
  15347. is read-only, hidden or system).  EXECUTE bit is set for directories,
  15348. files which can be executed from the DOS prompt (batch files, .com,
  15349. .dll and .exe executables) or run by `go32-v2.exe'.  For files which
  15350. reside on networked drives under Novell Netware, this can sometimes
  15351. fail, in which case only the read access bit is set.
  15352.  
  15353. 4. The variable `_djstat_flags' (*note _djstat_flags::.) controls what
  15354. hard-to-get fields of `struct stat' are needed by the application.
  15355.  
  15356. 
  15357. File: libc.info,  Node: fsync,  Next: ftell,  Prev: fstat,  Up: Alphabetical List
  15358.  
  15359. fsync
  15360. =====
  15361.  
  15362. Syntax
  15363. ------
  15364.  
  15365.      #include <unistd.h>
  15366.      
  15367.      int fsync(int file);
  15368.  
  15369. Description
  15370. -----------
  15371.  
  15372. Forces all information about the file with the given descriptor to be
  15373. synchronized with the disk image.  Works by calling DOS function 0x68.
  15374. *Warning*: External disk caches are not flushed by this function.
  15375.  
  15376. Return Value
  15377. ------------
  15378.  
  15379. Zero on success, nonzero on failure.
  15380.  
  15381. Portability
  15382. -----------
  15383.  
  15384. not ANSI, not POSIX
  15385.  
  15386. Example
  15387. -------
  15388.  
  15389.      fsync(fileno(stdout));
  15390.  
  15391. 
  15392. File: libc.info,  Node: ftell,  Next: ftime,  Prev: fsync,  Up: Alphabetical List
  15393.  
  15394. ftell
  15395. =====
  15396.  
  15397. Syntax
  15398. ------
  15399.  
  15400.      #include <stdio.h>
  15401.      
  15402.      long ftell(FILE *file);
  15403.  
  15404. Description
  15405. -----------
  15406.  
  15407. Returns the current file position for `file'.  This is suitable for a
  15408. future call to `fseek'.
  15409.  
  15410. Return Value
  15411. ------------
  15412.  
  15413. The file position, or -1 on error.
  15414.  
  15415. Portability
  15416. -----------
  15417.  
  15418. ANSI, POSIX
  15419.  
  15420. Example
  15421. -------
  15422.  
  15423.      long p = ftell(stdout);
  15424.  
  15425. 
  15426. File: libc.info,  Node: ftime,  Next: ftruncate,  Prev: ftell,  Up: Alphabetical List
  15427.  
  15428. ftime
  15429. =====
  15430.  
  15431. Syntax
  15432. ------
  15433.  
  15434.      #include <sys/timeb.h>
  15435.      
  15436.      int ftime(struct timeb *buf);
  15437.  
  15438. Description
  15439. -----------
  15440.  
  15441. This function stores the current time in the structure BUF.  The format
  15442. of `struct timeb' is:
  15443.  
  15444.      struct timeb {
  15445.        time_t         time;     /* seconds since 00:00:00 GMT 1/1/1970 */
  15446.        unsigned short millitm;  /* milliseconds */
  15447.        short          timezone; /* difference between GMT and local, minutes */
  15448.        short          dstflag;  /* set if daylight savings time in affect */
  15449.      };
  15450.  
  15451. Return Value
  15452. ------------
  15453.  
  15454. Zero on success, nonzero on error.
  15455.  
  15456. Portability
  15457. -----------
  15458.  
  15459. not ANSI, not POSIX
  15460.  
  15461. Example
  15462. -------
  15463.  
  15464.      struct timeb t;
  15465.      ftime(&t);
  15466.  
  15467. 
  15468. File: libc.info,  Node: ftruncate,  Next: ftw,  Prev: ftime,  Up: Alphabetical List
  15469.  
  15470. ftruncate
  15471. =========
  15472.  
  15473. Syntax
  15474. ------
  15475.  
  15476.      #include <unistd.h>
  15477.      
  15478.      int ftruncate(int handle, off_t where);
  15479.  
  15480. Description
  15481. -----------
  15482.  
  15483. This function truncates the file open on HANDLE at byte position WHERE.
  15484. The file pointer associated with HANDLE is not changed.
  15485.  
  15486. Note that this function knows nothing about buffering by stdio functions
  15487. like `fwrite' and `fprintf', so if HANDLE comes from a `FILE' object,
  15488. you need to call `fflush' before calling this function.
  15489.  
  15490. Return Value
  15491. ------------
  15492.  
  15493. Zero for success, nonzero for failure.
  15494.  
  15495. Portability
  15496. -----------
  15497.  
  15498. not ANSI, not POSIX
  15499.  
  15500. Example
  15501. -------
  15502.  
  15503.      int x = open("data", O_WRONLY);
  15504.      ftruncate(x, 1000);
  15505.      close(x);
  15506.  
  15507. 
  15508. File: libc.info,  Node: ftw,  Next: _fwalk,  Prev: ftruncate,  Up: Alphabetical List
  15509.  
  15510. ftw
  15511. ===
  15512.  
  15513. Syntax
  15514. ------
  15515.  
  15516.      #include <ftw.h>
  15517.      
  15518.      int ftw(const char *dir,
  15519.              int (*func)(const char *path, struct stat *stbuf, int flag),
  15520.              int depth);
  15521.  
  15522. Description
  15523. -----------
  15524.  
  15525. This function recursively descends the directory hierarchy which starts
  15526. with DIR.  For each file in the hierarchy, `ftw' calls the user-defined
  15527. function FUNC which is passed a pointer to a `NULL'-terminated
  15528. character array in PATH holding the full pathname of the file, a
  15529. pointer to a `stat' structure (*note stat::.)  STBUF with a filesystem
  15530. information about that file, and an integer FLAG.  Possible values of
  15531. FLAG are:
  15532.  
  15533. `FTW_F'
  15534.      This is a regular file.
  15535.  
  15536. `FTW_D'
  15537.      This is a directory.
  15538.  
  15539. `FTW_VL'
  15540.      This is a volume label.
  15541.  
  15542. `FTW_DNR'
  15543.      This is a directory which cannot be read with `readdir()'.  (This
  15544.      will never happen in DJGPP.)
  15545.  
  15546. `FTW_NS'
  15547.      This file exists, but `stat' fails for it.
  15548.  
  15549. If FLAG is `FTW_DNR', the descendants of that directory won't be
  15550. processed.  If FLAG is `FTW_NS', then STBUF will be garbled.
  15551.  
  15552. This function always visits a directory before any of its siblings.  The
  15553. argument DIR must be a directory, or `ftw' will fail and set ERRNO to
  15554. `ENOTDIR'.  The function FUNC is called with DIR as its argument before
  15555. the recursive descent begins.
  15556.  
  15557. The DEPTH argument has no meaning in the DJGPP implementation and is
  15558. always ignored.
  15559.  
  15560. The tree traversal continues until one of the following events:
  15561.  
  15562. (1)  The tree is exhausted (i.e., all descendants of DIR are
  15563. processed).  In this case, `ftw' returns 0, meaning a success.
  15564.  
  15565. (2)  An invocation of FUNC returns a non-zero value.  In this case,
  15566. `ftw' stops the tree traversal and returns whatever FUNC returned.
  15567.  
  15568. (3)  An error is detected within `ftw'.  In that case, `ftw' returns -1
  15569. and sets ERRNO (*note errno::.) to a suitable value.
  15570.  
  15571. Return Value
  15572. ------------
  15573.  
  15574. Zero in case the entire tree was successfully traversed, -1 if `ftw'
  15575. detected some error during its operation, or any other non-zero value
  15576. which was returned by the user-defined function FUNC.
  15577.  
  15578. Implementation Notes
  15579. --------------------
  15580.  
  15581. This function uses `malloc' (*note malloc::.) for dynamic memory
  15582. allocation during its operation.  If FUNC disrupts the normal flow of
  15583. code execution by e.g. calling `longjump' or if an interrupt handler
  15584. which never returns is executed, this memory will remain permanently
  15585. allocated.
  15586.  
  15587. This function calls `opendir()' and `readdir()' functions to read the
  15588. directory entries.  Therefore, you can control what files will your
  15589. FUNC get by setting the appropriate bits in the external variable
  15590. __OPENDIR_FLAGS.  *Note opendir::, for description of these bits.
  15591.  
  15592. This function also calls `stat' for every directory entry it passes to
  15593. FUNC.  If your application only needs some part of the information
  15594. returned in the `stat' structure, you can make your application
  15595. significantly faster by setting bits in the external variable
  15596. _DJSTAT_FLAGS (*note _djstat_flags::. for details).  The most expensive
  15597. `stat' features are `_STAT_EXEC_MAGIC' and `_STAT_DIRSIZE'.
  15598.  
  15599. Portability
  15600. -----------
  15601.  
  15602. not ANSI, not POSIX
  15603.  
  15604. Example
  15605. -------
  15606.  
  15607.      #include <stdlib.h>
  15608.      
  15609.      int
  15610.      file_walker(const char *path, struct stat *sb, int flag)
  15611.      {
  15612.        char *base;
  15613.      
  15614.        printf("%s:\t%u\t", path, sb->st_size);
  15615.        if (S_ISLABEL(sb->st_mode))
  15616.          printf("V");
  15617.        if (S_ISDIR(sb->st_mode))
  15618.          printf("D");
  15619.        if (S_ISCHR(sb->st_mode))
  15620.          printf("C");
  15621.        if (sb->st_mode & S_IRUSR)
  15622.          printf("r");
  15623.        if (sb->st_mode & S_IWUSR)
  15624.          printf("w");
  15625.        if (sb->st_mode & S_IXUSR)
  15626.          printf("x");
  15627.      
  15628.        if (flag == FTW_NS)
  15629.          printf("  !!no_stat!!");
  15630.        printf("\n");
  15631.      
  15632.        base = strrchr(path, '/');
  15633.        if (base == 0)
  15634.          base = strrchr(path, '\\');
  15635.        if (base == 0)
  15636.          base = strrchr(path, ':');
  15637.        if (strcmp(base == 0 ? path : base + 1, "xxxxx") == 0)
  15638.          return 42;
  15639.        return 0;
  15640.      }
  15641.      
  15642.      int
  15643.      main(int argc, char *argv[])
  15644.      {
  15645.        if (argc > 1)
  15646.          {
  15647.            char msg[80];
  15648.      
  15649.            sprintf(msg, "file_tree_walk: %d",
  15650.                         ftw(argv[1], file_walker, 0));
  15651.            if (errno)
  15652.              perror(msg);
  15653.            else
  15654.              puts(msg);
  15655.          }
  15656.        else
  15657.          printf("Usage: %s dir\n", argv[0]);
  15658.      
  15659.        return 0;
  15660.      }
  15661.  
  15662. 
  15663. File: libc.info,  Node: _fwalk,  Next: fwrite,  Prev: ftw,  Up: Alphabetical List
  15664.  
  15665. _fwalk
  15666. ======
  15667.  
  15668. Syntax
  15669. ------
  15670.  
  15671.      #include <libc/file.h>
  15672.      
  15673.      void _fwalk(void (*function)(FILE *file));
  15674.  
  15675. Description
  15676. -----------
  15677.  
  15678. For each open file in the system, the given FUNCTION is called, passing
  15679. the file pointer as its only argument.
  15680.  
  15681. Return Value
  15682. ------------
  15683.  
  15684. None.
  15685.  
  15686. Portability
  15687. -----------
  15688.  
  15689. not ANSI, not POSIX
  15690.  
  15691. Example
  15692. -------
  15693.  
  15694.      void pfile(FILE *x)
  15695.      { printf("FILE at %p\n", x); }
  15696.      
  15697.      _fwalk(pfile);
  15698.  
  15699. 
  15700. File: libc.info,  Node: fwrite,  Next: gcvt,  Prev: _fwalk,  Up: Alphabetical List
  15701.  
  15702. fwrite
  15703. ======
  15704.  
  15705. Syntax
  15706. ------
  15707.  
  15708.      #include <stdio.h>
  15709.      
  15710.      size_t fwrite(void *buffer, size_t size, size_t number, FILE *file);
  15711.  
  15712. Description
  15713. -----------
  15714.  
  15715. This function writes SIZE*NUMBER characters from BUFFER to FILE.
  15716.  
  15717. Return Value
  15718. ------------
  15719.  
  15720. The number of items of size SIZE written, or less if there was an error.
  15721.  
  15722. Portability
  15723. -----------
  15724.  
  15725. ANSI, POSIX
  15726.  
  15727. Example
  15728. -------
  15729.  
  15730.      int foo[10];
  15731.      fwrite(foo, sizeof(int), 10, stdin);
  15732.  
  15733. 
  15734. File: libc.info,  Node: gcvt,  Next: _get_dev_info,  Prev: fwrite,  Up: Alphabetical List
  15735.  
  15736. gcvt
  15737. ====
  15738.  
  15739. Syntax
  15740. ------
  15741.  
  15742.      #include <stdlib.h>
  15743.      
  15744.      char * gcvt (double value, int ndigits, char *buf)
  15745.  
  15746. Description
  15747. -----------
  15748.  
  15749. This function converts its argument VALUE into a null-terminated string
  15750. of NDIGITS significant digits in BUF.  BUF should have enough space to
  15751. hold at least `NDIGITS + 7' characters.  The result roughly corresponds
  15752. to what is obtained by the following snippet:
  15753.  
  15754.       (void) sprintf(buf, "%.*g", ndigits, value);
  15755.  
  15756. except that trailing zeros and trailing decimal point are suppressed.
  15757.  
  15758. The least-significant digit in BUF is rounded.
  15759.  
  15760. `ecvtbuf' produces the string "NaN" if VALUE is a NaN, and "Inf" if
  15761. VALUE is an infinity.
  15762.  
  15763. Return Value
  15764. ------------
  15765.  
  15766. A pointer to BUF.
  15767.  
  15768. Portability
  15769. -----------
  15770.  
  15771. not ANSI, not POSIX
  15772.  
  15773. Example
  15774. -------
  15775.  
  15776.        #include <stdlib.h>
  15777.        #include <stdio.h>
  15778.        #include <math.h>
  15779.      
  15780.        char vbuf[20];
  15781.      
  15782.        /* This will print " 3.14159".  */
  15783.        printf ("%s", gcvt (M_PI, 5, buf));
  15784.  
  15785. 
  15786. File: libc.info,  Node: _get_dev_info,  Next: _get_dos_version,  Prev: gcvt,  Up: Alphabetical List
  15787.  
  15788. _get_dev_info
  15789. =============
  15790.  
  15791. Syntax
  15792. ------
  15793.  
  15794.      #include <io.h>
  15795.      
  15796.      short _get_dev_info(int handle);
  15797.  
  15798. Description
  15799. -----------
  15800.  
  15801. Given a file handle in HANDLE, this function returns the info word from
  15802. DOS IOCTL function 0 (Int 21h/AX=4400h).  HANDLE must refer to an open
  15803. file or device, otherwise the call will fail (and set ERRNO to `EBADF').
  15804.  
  15805. In case of success, the returned value is the coded information from the
  15806. system about the character device or the file which is referenced by the
  15807. file handle HANDLE.  The following table shows the meaning of the
  15808. individual bits in the return value:
  15809.  
  15810. For a character device:
  15811.  
  15812. Bit(s)  Description                                     
  15813. 14      Device can process IOCTL functions 02h and 03h  
  15814. 13      Device supports output-until-busy               
  15815. 11      Device supports OPEN/CLOSE calls                
  15816. 8       Unknown; set by MS-DOS 6.2x `KEYBXX.COM'        
  15817. 7       Always set for character devices                
  15818. 6       End of file on input                            
  15819. 5       Device is in *raw* (binary) mode                
  15820. 4       Device uses Int 29h                             
  15821. 3       Clock device                                    
  15822. 2       NUL device                                      
  15823. 1       Standard output device                          
  15824. 0       Standard input device                           
  15825.  
  15826. For a block device (a disk file):
  15827.  
  15828. Bit(s)  Description                                     
  15829. 15      Device is remote (networked drive)              
  15830. 14      Don't set file time stamp on close              
  15831. 11      If set, non-removable media                     
  15832. 11      If clear, media is removable (e.g. floppy disk) 
  15833. 8       Generate Int 24h if full disk or read past EOF  
  15834. 7       Always clear for disk files                     
  15835. 6       File has not been written to                    
  15836. 5-0     Drive number (0 = A:)                           
  15837.  
  15838. Note that the functionality indicated by bit 8 for the block devices is
  15839. only supported by DOS version 4.
  15840.  
  15841. "Cooked" mode means that on input `C-<C>', `C-<P>', `C-<S>' and `C-<Z>'
  15842. are processed, on output `TAB's are expanded into spaces and `CR'
  15843. character is added before each `LF', and input is terminated when the
  15844. <RET> key is pressed.  In contrast, in "raw" mode, all the special
  15845. characters are passed verbatim, and the read operation waits until the
  15846. specified number of characters has been read.
  15847.  
  15848. Return Value
  15849. ------------
  15850.  
  15851. The device information word described above.  In case of error, -1 is
  15852. returned and ERRNO is set to `EBADF'.
  15853.  
  15854. Portability
  15855. -----------
  15856.  
  15857. not ANSI, not POSIX
  15858.  
  15859. Example
  15860. -------
  15861.  
  15862.       int fd = open ("CLOCK$", O_RDONLY | O_BINARY);
  15863.       int clock_info = _get_dev_info (fd);
  15864.  
  15865. 
  15866. File: libc.info,  Node: _get_dos_version,  Next: _get_volume_info,  Prev: _get_dev_info,  Up: Alphabetical List
  15867.  
  15868. _get_dos_version
  15869. ================
  15870.  
  15871. Syntax
  15872. ------
  15873.  
  15874.      #include <dos.h>
  15875.      
  15876.      extern unsigned short   _osmajor, _osminor;
  15877.      extern const    char  * _os_flavor;
  15878.      
  15879.      unsigned short _get_dos_version(int true_version);
  15880.  
  15881. Description
  15882. -----------
  15883.  
  15884. This function gets the host OS version and flavor.  If the argument
  15885. TRUE_VERSION is non-zero, it will return a `true' version number, which
  15886. is unaffected by possible tinkering with SETVER TSR program.  (This is
  15887. only available in DOS 5.0 or later.)
  15888.  
  15889. The external variables `_osmajor' and `_osminor' will always be set to
  15890. the major and minor parts of the `advertised' version number, possibly
  15891. changed by SETVER, even if TRUE_VERSION is non-zero.  You typically
  15892. need the true version when you need an intimate knowledge of the host
  15893. OS internals, like when using undocumented features.  Note that some
  15894. DOS clones (notably, DR-DOS) do not support DOS function required to
  15895. report the true DOS version; for these, the version reported might be
  15896. affected by SETVER even if TRUE_VERSION is non-zero.
  15897.  
  15898. The external variable `_os_flavor' will point to a string which
  15899. describes the OEM name of the host OS variety.
  15900.  
  15901. Return Value
  15902. ------------
  15903.  
  15904. `_get_dos_version()' returns the version number (true version number,
  15905. if TRUE_VERSION is non-zero) as a 16-bit number: the major part of the
  15906. version in the upper 8 bits, the minor part in the lower 8 bits.  For
  15907. instance, DOS version 6.20 will be returned as 0x0614.
  15908.  
  15909. Portability
  15910. -----------
  15911.  
  15912. not ANSI, not POSIX
  15913.  
  15914. Example
  15915. -------
  15916.  
  15917.        unsigned short true_dos_version = _get_dos_version(1);
  15918.      
  15919.        if (true_dos_version < 0x0614)   /* require DOS 6.20 or later */
  15920.          puts("This program needs DOS 6.20 or later to run");
  15921.        else
  15922.          printf("You are running %s variety of DOS\n", _os_flavor);
  15923.  
  15924. 
  15925. File: libc.info,  Node: _get_volume_info,  Next: getc,  Prev: _get_dos_version,  Up: Alphabetical List
  15926.  
  15927. _get_volume_info
  15928. ================
  15929.  
  15930. Syntax
  15931. ------
  15932.  
  15933.      #include <fcntl.h>
  15934.      
  15935.      unsigned _get_volume_info (const char *path,
  15936.                                 int *max_file_len, int *max_path_len,
  15937.                                 char *fsystype);
  15938.  
  15939. Description
  15940. -----------
  15941.  
  15942. This function returns filesystem information about the volume where
  15943. PATH resides.  Only the root directory name part is actually used; if
  15944. PATH does not specify the drive explicitly, or is a `NULL' pointer, the
  15945. current drive is used.  Upon return, the variable pointed to by
  15946. MAX_FILE_LEN contains the maximum length of a filename (including the
  15947. terminating zero), the variable pointed to by MAX_PATH_LEN contains the
  15948. maximum length of a pathname (including the terminating zero), and a
  15949. string that identifies the filesystem type (e.g., "FAT", "NTFS" etc.)
  15950. is placed into the buffer pointed to by FSYSTYPE, which should be long
  15951. enough (32 bytes are usually enough).  If any of these pointers is a
  15952. `NULL' pointer, it will be ignored.  The function returns various flags
  15953. that describe features supported by the given filesystem as a
  15954. bit-mapped number.  The following bits are currently defined:
  15955.  
  15956. `_FILESYS_CASE_SENSITIVE'
  15957.      Specifies that file searches are case-sensitive.
  15958.  
  15959. `_FILESYS_CASE_PRESERVED'
  15960.      Filename letter-case is preserved in directory entries.
  15961.  
  15962. `_FILESYS_UNICODE'
  15963.      Filesystem uses Unicode characters in file and directory names.
  15964.  
  15965. `_FILESYS_LFN_SUPPORTED'
  15966.      Filesystem supports the "Long File Name" (LFN) API.
  15967.  
  15968. `_FILESYS_VOL_COMPRESSED'
  15969.      This volume is compressed.
  15970.  
  15971. `_FILESYS_UNKNOWN'
  15972.      The underlying system call failed.  This usually means that the
  15973.      drive letter is invalid, like when a floppy drive is empty or a
  15974.      drive with that letter doesn't exist.
  15975.  
  15976. Return value
  15977. ------------
  15978.  
  15979. A combination of the above bits if the LFN API is supported, or 0 (and
  15980. `errno' set to `ENOSYS') if the LFN API is not supported by the OS.  If
  15981. the drive letter is invalid, the function returns `_FILESYS_UNKNOWN'
  15982. and sets `errno' to either `ENODEV' or `ENXIO'.
  15983.  
  15984. Portability
  15985. -----------
  15986.  
  15987. not ANSI, not POSIX
  15988.  
  15989. 
  15990. File: libc.info,  Node: getc,  Next: getcbrk,  Prev: _get_volume_info,  Up: Alphabetical List
  15991.  
  15992. getc
  15993. ====
  15994.  
  15995. Syntax
  15996. ------
  15997.  
  15998.      #include <stdio.h>
  15999.      
  16000.      int getc(FILE *file);
  16001.  
  16002. Description
  16003. -----------
  16004.  
  16005. Get one character from FILE.
  16006.  
  16007. Return Value
  16008. ------------
  16009.  
  16010. The character ([0..255]) or `EOF' if eof or error.
  16011.  
  16012. Portability
  16013. -----------
  16014.  
  16015. ANSI, POSIX
  16016.  
  16017. Example
  16018. -------
  16019.  
  16020.      int c;
  16021.      while ((c=getc(stdin)) != EOF)
  16022.        putc(c, stdout);
  16023.  
  16024. 
  16025. File: libc.info,  Node: getcbrk,  Next: getch,  Prev: getc,  Up: Alphabetical List
  16026.  
  16027. getcbrk
  16028. =======
  16029.  
  16030. Syntax
  16031. ------
  16032.  
  16033.      #include <dos.h>
  16034.      
  16035.      int getcbrk(void);
  16036.  
  16037. Description
  16038. -----------
  16039.  
  16040. Get the setting of the Ctrl-C checking flag in MS-DOS.
  16041.  
  16042. *Note setcbrk::.
  16043.  
  16044. Return Value
  16045. ------------
  16046.  
  16047. 0 if not checking, 1 if checking.
  16048.  
  16049. Portability
  16050. -----------
  16051.  
  16052. not ANSI, not POSIX
  16053.  
  16054. 
  16055. File: libc.info,  Node: getch,  Next: getchar,  Prev: getcbrk,  Up: Alphabetical List
  16056.  
  16057. getch
  16058. =====
  16059.  
  16060. Syntax
  16061. ------
  16062.  
  16063.      #include <conio.h>
  16064.      
  16065.      int     getch(void);
  16066.  
  16067. Description
  16068. -----------
  16069.  
  16070. A single character from the predefined standard input handle is read and
  16071. returned.  The input is not buffered.  If there is a character pending
  16072. from `ungetch' (*note ungetch::.), it is returned instead.  The
  16073. character is not echoed to the screen.  This function doesn't check for
  16074. special characters like `Ctrl-<C>'.
  16075.  
  16076. If the standard input handle is connected to the console, any pending
  16077. output in the `stdout' and `stderr' streams is flushed before reading
  16078. the input, if these streams are connected to the console.
  16079.  
  16080. Return Value
  16081. ------------
  16082.  
  16083. The character.
  16084.  
  16085. Portability
  16086. -----------
  16087.  
  16088. not ANSI, not POSIX
  16089.  
  16090. 
  16091. File: libc.info,  Node: getchar,  Next: getche,  Prev: getch,  Up: Alphabetical List
  16092.  
  16093. getchar
  16094. =======
  16095.  
  16096. Syntax
  16097. ------
  16098.  
  16099.      #include <stdio.h>
  16100.      
  16101.      int getchar(void);
  16102.  
  16103. Description
  16104. -----------
  16105.  
  16106. The same as `fgetc(stdin)' (*note fgetc::.).
  16107.  
  16108. Return Value
  16109. ------------
  16110.  
  16111. The character, or `EOF'.
  16112.  
  16113. Portability
  16114. -----------
  16115.  
  16116. ANSI, POSIX
  16117.  
  16118. 
  16119. File: libc.info,  Node: getche,  Next: getcwd,  Prev: getchar,  Up: Alphabetical List
  16120.  
  16121. getche
  16122. ======
  16123.  
  16124. Syntax
  16125. ------
  16126.  
  16127.      #include <conio.h>
  16128.      
  16129.      int getche(void);
  16130.  
  16131. Description
  16132. -----------
  16133.  
  16134. A single character from the predefined standard input handle is read and
  16135. returned.  The input is not buffered.  If there is a character pending
  16136. from `ungetch' (*note ungetch::.), it is returned instead.  The
  16137. character is echoed to the screen.  This function doesn't check for
  16138. special characters like `Ctrl-<C>'.
  16139.  
  16140. If the standard input handle is connected to the console, any pending
  16141. output in the `stdout' and `stderr' streams is flushed before reading
  16142. the input, if these streams are connected to the console.
  16143.  
  16144. Return Value
  16145. ------------
  16146.  
  16147. The character.
  16148.  
  16149. Portability
  16150. -----------
  16151.  
  16152. not ANSI, not POSIX
  16153.  
  16154. 
  16155. File: libc.info,  Node: getcwd,  Next: getdate,  Prev: getche,  Up: Alphabetical List
  16156.  
  16157. getcwd
  16158. ======
  16159.  
  16160. Syntax
  16161. ------
  16162.  
  16163.      #include <unistd.h>
  16164.      
  16165.      char *getcwd(char *buffer, int max);
  16166.  
  16167. Description
  16168. -----------
  16169.  
  16170. Get the current directory.  The return value includes the drive
  16171. specifier.  If BUFFER is `NULL', `getcwd' allocates memory with
  16172. `malloc'.  This call fails if more than MAX characters are required to
  16173. specify the current directory.
  16174.  
  16175. Return Value
  16176. ------------
  16177.  
  16178. The buffer, either BUFFER or a newly-allocated buffer, or `NULL' on
  16179. error.
  16180.  
  16181. Portability
  16182. -----------
  16183.  
  16184. not ANSI, POSIX
  16185.  
  16186. Example
  16187. -------
  16188.  
  16189.      char *buf = (char *)malloc(PATH_MAX);
  16190.      if (buf && getcwd(buf, PATH_MAX))
  16191.      {
  16192.        printf("cwd is %s\n", buf);
  16193.        free(buf);
  16194.      }
  16195.  
  16196. 
  16197. File: libc.info,  Node: getdate,  Next: getdfree,  Prev: getcwd,  Up: Alphabetical List
  16198.  
  16199. getdate
  16200. =======
  16201.  
  16202. Syntax
  16203. ------
  16204.  
  16205.      #include <dos.h>
  16206.      
  16207.      void getdate(struct date *);
  16208.  
  16209. Description
  16210. -----------
  16211.  
  16212. This function gets the current date.  The return structure is as
  16213. follows:
  16214.  
  16215.      struct date {
  16216.        short da_year;
  16217.        char  da_day;
  16218.        char  da_mon;
  16219.      };
  16220.  
  16221. *Note setdate::. *Note gettime::.
  16222.  
  16223. Return Value
  16224. ------------
  16225.  
  16226. None.
  16227.  
  16228. Portability
  16229. -----------
  16230.  
  16231. not ANSI, not POSIX
  16232.  
  16233. Example
  16234. -------
  16235.  
  16236.      struct date d;
  16237.      getdate(&d);
  16238.  
  16239. 
  16240. File: libc.info,  Node: getdfree,  Next: getdisk,  Prev: getdate,  Up: Alphabetical List
  16241.  
  16242. getdfree
  16243. ========
  16244.  
  16245. Syntax
  16246. ------
  16247.  
  16248.      #include <dos.h>
  16249.      
  16250.      void getdfree(unsigned char drive, struct dfree *ptr);
  16251.  
  16252. Description
  16253. -----------
  16254.  
  16255. This function gets information about the size and fullness of the given
  16256. drive (0=default, 1=A:, etc).  The return structure is as follows:
  16257.  
  16258.      struct dfree {
  16259.        unsigned df_avail; /* number of available clusters */
  16260.        unsigned df_total; /* total number of clusters */
  16261.        unsigned df_bsec;  /* bytes per sector */
  16262.        unsigned df_sclus; /* sectors per cluster */
  16263.      };
  16264.  
  16265. Return Value
  16266. ------------
  16267.  
  16268. None.
  16269.  
  16270. Portability
  16271. -----------
  16272.  
  16273. not ANSI, not POSIX
  16274.  
  16275. Example
  16276. -------
  16277.  
  16278.      struct dfree d;
  16279.      getdfree(3, &d); /* drive C: */
  16280.  
  16281. 
  16282. File: libc.info,  Node: getdisk,  Next: getdtablesize,  Prev: getdfree,  Up: Alphabetical List
  16283.  
  16284. getdisk
  16285. =======
  16286.  
  16287. Syntax
  16288. ------
  16289.  
  16290.      #include <dir.h>
  16291.      
  16292.      int getdisk(void);
  16293.  
  16294. Description
  16295. -----------
  16296.  
  16297. Gets the current disk (0=A).
  16298.  
  16299. *Note setdisk::.
  16300.  
  16301. Return Value
  16302. ------------
  16303.  
  16304. The current disk number.
  16305.  
  16306. Portability
  16307. -----------
  16308.  
  16309. not ANSI, not POSIX
  16310.  
  16311. Example
  16312. -------
  16313.  
  16314.      printf("This drive is %c:\n", getdisk() + 'A');
  16315.  
  16316. 
  16317. File: libc.info,  Node: getdtablesize,  Next: getegid,  Prev: getdisk,  Up: Alphabetical List
  16318.  
  16319. getdtablesize
  16320. =============
  16321.  
  16322. Syntax
  16323. ------
  16324.  
  16325.      #include <unistd.h>
  16326.      
  16327.      int getdtablesize(void);
  16328.  
  16329. Description
  16330. -----------
  16331.  
  16332. Get the maximum number of open file descriptors the system supports.
  16333.  
  16334. Return Value
  16335. ------------
  16336.  
  16337. 255
  16338.  
  16339. Portability
  16340. -----------
  16341.  
  16342. not ANSI, not POSIX
  16343.  
  16344. 
  16345. File: libc.info,  Node: getegid,  Next: getenv,  Prev: getdtablesize,  Up: Alphabetical List
  16346.  
  16347. getegid
  16348. =======
  16349.  
  16350. Syntax
  16351. ------
  16352.  
  16353.      #include <unistd.h>
  16354.      
  16355.      int getegid(void);
  16356.  
  16357. Description
  16358. -----------
  16359.  
  16360. Get the effective group id.
  16361.  
  16362. Return Value
  16363. ------------
  16364.  
  16365. 42
  16366.  
  16367. Portability
  16368. -----------
  16369.  
  16370. not ANSI, POSIX
  16371.  
  16372. 
  16373. File: libc.info,  Node: getenv,  Next: geteuid,  Prev: getegid,  Up: Alphabetical List
  16374.  
  16375. getenv
  16376. ======
  16377.  
  16378. Syntax
  16379. ------
  16380.  
  16381.      #include <stdlib.h>
  16382.      
  16383.      char *getenv(const char *name);
  16384.  
  16385. Description
  16386. -----------
  16387.  
  16388. Get the setting of the environment variable NAME.  Do not alter or free
  16389. the returned value.
  16390.  
  16391. Return Value
  16392. ------------
  16393.  
  16394. The value, or `NULL' if that variable does not exist.
  16395.  
  16396. Portability
  16397. -----------
  16398.  
  16399. ANSI, POSIX
  16400.  
  16401. Example
  16402. -------
  16403.  
  16404.      char *term = getenv("TERM");
  16405.  
  16406. 
  16407. File: libc.info,  Node: geteuid,  Next: getftime,  Prev: getenv,  Up: Alphabetical List
  16408.  
  16409. geteuid
  16410. =======
  16411.  
  16412. Syntax
  16413. ------
  16414.  
  16415.      #include <unistd.h>
  16416.      
  16417.      int geteuid(void);
  16418.  
  16419. Description
  16420. -----------
  16421.  
  16422. Gets the effective UID.
  16423.  
  16424. Return Value
  16425. ------------
  16426.  
  16427. 42
  16428.  
  16429. Portability
  16430. -----------
  16431.  
  16432. not ANSI, POSIX
  16433.  
  16434. 
  16435. File: libc.info,  Node: getftime,  Next: getgid,  Prev: geteuid,  Up: Alphabetical List
  16436.  
  16437. getftime
  16438. ========
  16439.  
  16440. Syntax
  16441. ------
  16442.  
  16443.      #include <dos.h>
  16444.      
  16445.      int getftime(int handle, struct ftime *ptr);
  16446.  
  16447. Description
  16448. -----------
  16449.  
  16450. Get the timestamp for the given file handle.  The return structure is as
  16451. follows:
  16452.  
  16453.      struct ftime {
  16454.        unsigned ft_tsec:5;    /* 0-29, double to get real seconds */
  16455.        unsigned ft_min:6;    /* 0-59 */
  16456.        unsigned ft_hour:5;    /* 0-23 */
  16457.        unsigned ft_day:5;    /* 1-31 */
  16458.        unsigned ft_month:4;    /* 1-12 */
  16459.        unsigned ft_year:7;    /* since 1980 */
  16460.      }
  16461.  
  16462. Return Value
  16463. ------------
  16464.  
  16465. Zero on success, nonzero on failure.
  16466.  
  16467. Portability
  16468. -----------
  16469.  
  16470. not ANSI, not POSIX
  16471.  
  16472. Example
  16473. -------
  16474.  
  16475.      struct ftime t;
  16476.      getftime(fd, &t);
  16477.  
  16478. 
  16479. File: libc.info,  Node: getgid,  Next: getgrent,  Prev: getftime,  Up: Alphabetical List
  16480.  
  16481. getgid
  16482. ======
  16483.  
  16484. Syntax
  16485. ------
  16486.  
  16487.      #include <unistd.h>
  16488.      
  16489.      int getgid(void);
  16490.  
  16491. Description
  16492. -----------
  16493.  
  16494. Get the current group id.
  16495.  
  16496. Return Value
  16497. ------------
  16498.  
  16499. 42
  16500.  
  16501. Portability
  16502. -----------
  16503.  
  16504. not ANSI, POSIX
  16505.  
  16506. 
  16507. File: libc.info,  Node: getgrent,  Next: getgrgid,  Prev: getgid,  Up: Alphabetical List
  16508.  
  16509. getgrent
  16510. ========
  16511.  
  16512. Syntax
  16513. ------
  16514.  
  16515.      #include <grp.h>
  16516.      
  16517.      struct group *getgrent(void);
  16518.  
  16519. Description
  16520. -----------
  16521.  
  16522. This function returns the next available group entry.  Note that for
  16523. MS-DOS, this is simulated.  If the environment variable GROUP is set,
  16524. that is the name of the only group returned, else the only group is
  16525. "dos".  Thus, under DOS, `getgrent' will always fail on the second and
  16526. subsequent calls.
  16527.  
  16528. The return type of this and related function is as follows:
  16529.  
  16530.      struct group {
  16531.        gid_t    gr_gid;    /* result of getgid() */
  16532.        char  ** gr_mem;    /* gr_mem[0] points to
  16533.                                getenv("USER"/"LOGNAME") or "user" */
  16534.        char  *  gr_name;   /* getenv("GROUP") or "dos" */
  16535.      };
  16536.  
  16537. Return Value
  16538. ------------
  16539.  
  16540. The next structure, or `NULL' at the end of the list.
  16541.  
  16542. Portability
  16543. -----------
  16544.  
  16545. not ANSI, not POSIX
  16546.  
  16547. Example
  16548. -------
  16549.  
  16550.  
  16551.      struct group *g;
  16552.      setgrent();
  16553.      while ((g = getgrent()) != NULL)
  16554.      {
  16555.        printf("group %s gid %d\n", g->gr_name, g->gr_gid);
  16556.      }
  16557.      endgrent();
  16558.  
  16559. 
  16560. File: libc.info,  Node: getgrgid,  Next: getgrnam,  Prev: getgrent,  Up: Alphabetical List
  16561.  
  16562. getgrgid
  16563. ========
  16564.  
  16565. Syntax
  16566. ------
  16567.  
  16568.      #include <grp.h>
  16569.      
  16570.      extern struct group *getgrgid(int gid);
  16571.  
  16572. Description
  16573. -----------
  16574.  
  16575. This function returns the group entry that matches GID.  *Note
  16576. getgrent::, for the description of `struct group'.
  16577.  
  16578. Return Value
  16579. ------------
  16580.  
  16581. The matching group, or `NULL' if none match.
  16582.  
  16583. Portability
  16584. -----------
  16585.  
  16586. not ANSI, POSIX
  16587.  
  16588. 
  16589. File: libc.info,  Node: getgrnam,  Next: getgroups,  Prev: getgrgid,  Up: Alphabetical List
  16590.  
  16591. getgrnam
  16592. ========
  16593.  
  16594. Syntax
  16595. ------
  16596.  
  16597.      #include <grp.h>
  16598.      
  16599.      struct group *getgrnam(char *name);
  16600.  
  16601. Description
  16602. -----------
  16603.  
  16604. This function returns the group entry for the group named NAME.  *Note
  16605. getgrent::, for the description of `struct group'.
  16606.  
  16607. Return Value
  16608. ------------
  16609.  
  16610. The matching group, or `NULL' if none match.
  16611.  
  16612. Portability
  16613. -----------
  16614.  
  16615. not ANSI, POSIX
  16616.  
  16617. 
  16618. File: libc.info,  Node: getgroups,  Next: gethostname,  Prev: getgrnam,  Up: Alphabetical List
  16619.  
  16620. getgroups
  16621. =========
  16622.  
  16623. Syntax
  16624. ------
  16625.  
  16626.      #include <unistd.h>
  16627.      
  16628.      int getgroups(int size, gid_t *grouplist);
  16629.  
  16630. Description
  16631. -----------
  16632.  
  16633. This function always returns zero. It exists to assist porting from
  16634. Unix.
  16635.  
  16636. Return Value
  16637. ------------
  16638.  
  16639. Zero.
  16640.  
  16641. Portability
  16642. -----------
  16643.  
  16644. not ANSI, POSIX
  16645.  
  16646. 
  16647. File: libc.info,  Node: gethostname,  Next: getitimer,  Prev: getgroups,  Up: Alphabetical List
  16648.  
  16649. gethostname
  16650. ===========
  16651.  
  16652. Syntax
  16653. ------
  16654.  
  16655.      #include <unistd.h>
  16656.      #include <sys/param.h>
  16657.      
  16658.      int gethostname (char *buf, int size);
  16659.  
  16660. Description
  16661. -----------
  16662.  
  16663. Get the name of the host the program is executing on.  This name is
  16664. obtained from the network software, if present, otherwise from the
  16665. `"HOSTNAME"' environment variable, if present, finally defaulting to
  16666. `"pc"'.
  16667.  
  16668. The call fails if more than SIZE characters are required to specify the
  16669. host name.  A buffer size of `MAXGETHOSTNAME' is guaranteed to be
  16670. enough.
  16671.  
  16672. Return Value
  16673. ------------
  16674.  
  16675. Zero on success, nonzero on failure.
  16676.  
  16677. Portability
  16678. -----------
  16679.  
  16680. not ANSI, not POSIX
  16681.  
  16682. Example
  16683. -------
  16684.  
  16685.      char *buf = (char *) malloc (MAXGETHOSTNAME);
  16686.      if (buf && 0 == gethostname (buf, MAXGETHOSTNAME))
  16687.        printf ("We're on %s\n", buf);
  16688.      if (buf) free(buf);
  16689.  
  16690. 
  16691. File: libc.info,  Node: getitimer,  Next: getkey,  Prev: gethostname,  Up: Alphabetical List
  16692.  
  16693. getitimer
  16694. =========
  16695.  
  16696. Syntax
  16697. ------
  16698.  
  16699.      #include <sys/time.h>
  16700.      
  16701.      int getitimer(int which, struct itimerval *value);
  16702.  
  16703. Description
  16704. -----------
  16705.  
  16706. This function gets the current value of the interval timer specified by
  16707. WHICH into structure VALUE.  Variable WHICH can have the value of
  16708. `ITIMER_REAL' or `ITIMER_PROF'.  *Note setitimer::, for more details
  16709. about timers.
  16710.  
  16711. Upon return, the `it_value' member of VALUE will hold the amount of
  16712. time left until timer expiration, or zero if the timer has expired or
  16713. was stopped by a previous call to `setitimer'.  The `it_interval'
  16714. member will hold the interval between two successive alarms as set by
  16715. the last call to `setitimer' (but note that interval values less than
  16716. the system clock granularity are rounded up to that granularity).  The
  16717. value returned in `it_interval' member is *not* set to zero when the
  16718. timer is stopped, it always retains the interval that was last in use.
  16719.  
  16720. Return Value
  16721. ------------
  16722.  
  16723. Returns 0 on success, -1 on failure (and sets `errno').
  16724.  
  16725. Portability
  16726. -----------
  16727.  
  16728. not ANSI, not POSIX
  16729.  
  16730. 
  16731. File: libc.info,  Node: getkey,  Next: getlogin,  Prev: getitimer,  Up: Alphabetical List
  16732.  
  16733. getkey
  16734. ======
  16735.  
  16736. Syntax
  16737. ------
  16738.  
  16739.      #include <pc.h>
  16740.      #include <keys.h>
  16741.      
  16742.      int getkey(void);
  16743.  
  16744. Description
  16745. -----------
  16746.  
  16747. Waits for the user to press one key, then returns that key.  Alt-key
  16748. combinations have 0x100 added to them.  Extended keys return their
  16749. non-extended codes.
  16750.  
  16751. The file `keys.h' has symbolic names for many of the keys.
  16752.  
  16753. *Note getxkey::.
  16754.  
  16755. Return Value
  16756. ------------
  16757.  
  16758. The key pressed.
  16759.  
  16760. Portability
  16761. -----------
  16762.  
  16763. not ANSI, not POSIX
  16764.  
  16765. Example
  16766. -------
  16767.  
  16768.      while (getkey() != K_Alt_3)
  16769.        do_something();
  16770.  
  16771. 
  16772. File: libc.info,  Node: getlogin,  Next: getlongpass,  Prev: getkey,  Up: Alphabetical List
  16773.  
  16774. getlogin
  16775. ========
  16776.  
  16777. Syntax
  16778. ------
  16779.  
  16780.      #include <unistd.h>
  16781.      
  16782.      char *getlogin(void);
  16783.  
  16784. Description
  16785. -----------
  16786.  
  16787. Get the login ID of the user.
  16788.  
  16789. Return Value
  16790. ------------
  16791.  
  16792. Returns the value of the `USER' environment variable, else the
  16793. `LOGNAME' environment variable, else `"dosuser"'.
  16794.  
  16795. Portability
  16796. -----------
  16797.  
  16798. not ANSI, POSIX
  16799.  
  16800. Example
  16801. -------
  16802.  
  16803.      printf("I am %s\n", getlogin());
  16804.  
  16805. 
  16806. File: libc.info,  Node: getlongpass,  Next: getmntent,  Prev: getlogin,  Up: Alphabetical List
  16807.  
  16808. getlongpass
  16809. ===========
  16810.  
  16811. Syntax
  16812. ------
  16813.  
  16814.      #include <stdlib.h>
  16815.      
  16816.      int  getlongpass(const char *prompt, char *password, int max_length)
  16817.  
  16818. Description
  16819. -----------
  16820.  
  16821. This function reads up to a Newline (CR or LF) or EOF (Ctrl-D or Ctrl-Z)
  16822. from the standard input, without an echo, after prompting with a
  16823. null-terminated string PROMPT.  It puts a null-terminated string of at
  16824. most MAX_LENGTH - 1 first characters typed by the user into a buffer
  16825. pointed to by PASSWORD.  Pressing Ctrl-C or Ctrl-Break will cause the
  16826. calling program to `exit(1)'.
  16827.  
  16828. Return Value
  16829. ------------
  16830.  
  16831. Zero if successful, -1 on error (and ERRNO is set to an appropriate
  16832. value).
  16833.  
  16834. Portability
  16835. -----------
  16836.  
  16837. not ANSI, not POSIX
  16838.  
  16839. Example
  16840. -------
  16841.  
  16842.      char password[MAX_PASS];
  16843.      
  16844.      (void)getlongpass("Password: ", password, MAX_PASS);
  16845.  
  16846. 
  16847. File: libc.info,  Node: getmntent,  Next: getopt,  Prev: getlongpass,  Up: Alphabetical List
  16848.  
  16849. getmntent
  16850. =========
  16851.  
  16852. Syntax
  16853. ------
  16854.  
  16855.      #include <mntent.h>
  16856.      
  16857.      struct mntent *getmntent(FILE *filep);
  16858.  
  16859. Description
  16860. -----------
  16861.  
  16862. This function returns information about the various drives that are
  16863. available to your program.  Beginning with drive `A:', information is
  16864. retrieved for successive drives with successive calls to `getmntent'.
  16865. Note that drives `A:' and `B:' will only be returned if there is an
  16866. MS-DOS formatted disk in the drive; empty drives are skipped.  For
  16867. systems with a single floppy drive, it is returned as if it were
  16868. mounted on `A:/' or `B:/', depending on how it was last referenced (and
  16869. if there is a disk in the drive).
  16870.  
  16871. For each drive scanned, a pointer to a static structure of the following
  16872. type is returned:
  16873.  
  16874.      struct mntent
  16875.      {
  16876.          char * mnt_fsname;  /* The name of this file system */
  16877.          char * mnt_dir;     /* The root directory of this file system */
  16878.          char * mnt_type;    /* Filesystem type */
  16879.          char * mnt_opts;    /* Options, see below */
  16880.          int    mnt_freq;    /* -1 */
  16881.          int    mnt_passno;  /* -1 */
  16882.          long   mnt_time;    /* -1 */
  16883.      };
  16884.  
  16885. DJGPP implementation returns the following in the first 4 fields of
  16886. `struct mntent':
  16887.  
  16888. `mnt_fsname'
  16889.      For networked and CD-ROM drives, this is the name of root
  16890.      directory in the form `\\HOST\PATH' (this is called a "UNC name").
  16891.  
  16892.      For drives compressed with DoubleSpace, `mnt_fsname' is the string
  16893.      `X:\DBLSPACE.NNN', where X is the drive letter of the host drive
  16894.      and NNN is the sequence number of the Compressed Volume File.
  16895.  
  16896.      For drives compressed with Stacker, `mnt_fsname' is the string
  16897.      `X:\STACVOL.NNN', where X and NNN are as for DoubleSpace drives.
  16898.  
  16899.      For drives compressed with Jam (a shareware disk compression
  16900.      software), `mnt_fsname' is the full name of the Jam archive file.
  16901.  
  16902.      For SUBSTed drives, `mnt_fsname' is the actual directory name that
  16903.      that was SUBSTed to emulate a drive.
  16904.  
  16905.      JOINed drives get their `mnt_fsname' as if they were NOT JOINed
  16906.      (i.e., either the label name or the default `Drive X:').
  16907.  
  16908.      For drives with a volume label, `mnt_fsname' is the name of the
  16909.      label; otherwise the string `Drive X:', where X is the drive
  16910.      letter.
  16911.  
  16912. `mnt_dir'
  16913.      For most drives, this is the name of its root directory `X:/'
  16914.      (where X is the drive letter), except that JOINed drives get
  16915.      `mnt_dir' as the name of the directory to which they were JOINed.
  16916.  
  16917.      For systems with a single floppy drive (which can be referenced as
  16918.      either `a:/' or `b:/'), the mount directory will be returned as one
  16919.      of these, depending on which drive letter was last used to
  16920.      reference that drive.
  16921.  
  16922. `mnt_type'
  16923.            "fd"     for floppy disks
  16924.            "hd"     for hard disks
  16925.            "dblsp"  for disks compressed with DoubleSpace
  16926.            "stac"   for disks compressed with Stacker
  16927.            "jam"    for disks compressed with Jam
  16928.            "cdrom"  for CD-ROM drives
  16929.            "ram"    for RAM disks
  16930.            "subst"  for SUBSTed directories
  16931.            "join"   for JOINed disks
  16932.            "net"    for networked drives
  16933.  
  16934. `mnt_opts'
  16935.      The string `ro,dev=XX' for CD-ROM drives, `rw,dev=XX' for all the
  16936.      others, where XX is the hexadecimal drive number of the REAL drive
  16937.      on which this filesystem resides.  That is, if you call `stat' on
  16938.      MNT_FSNAME, you will get the numeric equivalent of XX in `st_dev'
  16939.      member of `struct stat'.  E.g., for drive `C:' you will get
  16940.      `rw,dev=02'.  Note that SUBSTed and JOINed drives get the drive
  16941.      numbers as if SUBST and JOIN were *not* in effect.
  16942.  
  16943. Return Value
  16944. ------------
  16945.  
  16946. This function returns a pointer to a `struct mntent', or `NULL' if
  16947. there are no more drives to report on.
  16948.  
  16949. Portability
  16950. -----------
  16951.  
  16952. not ANSI, not POSIX
  16953.  
  16954. Example
  16955. -------
  16956.  
  16957.      struct mntent *m;
  16958.      FILE *f;
  16959.      f = setmntent("/etc/mnttab", "r");
  16960.      while ((m = getmntent(f)))
  16961.        printf("Drive %s, name %s\n", m->mnt_dir, m->mnt_fsname);
  16962.      endmntent(f);
  16963.  
  16964. 
  16965. File: libc.info,  Node: getopt,  Next: getpagesize,  Prev: getmntent,  Up: Alphabetical List
  16966.  
  16967. getopt
  16968. ======
  16969.  
  16970. Syntax
  16971. ------
  16972.  
  16973.      #include <unistd.h>
  16974.      
  16975.      int getopt(int argc, char * const *argv, const char *options);
  16976.      extern char *optarg;
  16977.      extern int optind, opterr, optopt;
  16978.  
  16979. Description
  16980. -----------
  16981.  
  16982. Parse options from the command line.  The OPTIONS are a string of valid
  16983. option characters.  If a given option takes a parameter, that character
  16984. should be followed by a colon.
  16985.  
  16986. For each valid switch, this function sets `optarg' to the argument (if
  16987. the switch takes one), sets `optind' to the index in ARGV that it is
  16988. using, sets `optopt' to the option letter found, and returns the option
  16989. letter found.
  16990.  
  16991. If an unexpected option is found, `getopt' will return `?', and if
  16992. `opterr' is nonzero, will print an error message to stderr.
  16993.  
  16994. The special option `--' indicates that no more options follow on the
  16995. command line, and cause `getopt' to stop looking.
  16996.  
  16997. Return Value
  16998. ------------
  16999.  
  17000. The option found, or -1 if no more options.
  17001.  
  17002. Portability
  17003. -----------
  17004.  
  17005. not ANSI, POSIX
  17006.  
  17007. Example
  17008. -------
  17009.  
  17010.      int c;
  17011.      opterr = 0;
  17012.      while ((c=getopt(argc, argv, "vbf:")) != -1)
  17013.      {
  17014.        switch (c)
  17015.        {
  17016.          case 'v':
  17017.            verbose_flag ++;
  17018.            break;
  17019.          case 'b':
  17020.            binary_flag ++;
  17021.            break;
  17022.          case 'f':
  17023.            output_filename = optarg;
  17024.            break;
  17025.          case '?':
  17026.            printf("Unknown option %c\n", optopt);
  17027.            usage();
  17028.            exit(1);
  17029.        }
  17030.      }
  17031.  
  17032. 
  17033. File: libc.info,  Node: getpagesize,  Next: getpass,  Prev: getopt,  Up: Alphabetical List
  17034.  
  17035. getpagesize
  17036. ===========
  17037.  
  17038. Syntax
  17039. ------
  17040.  
  17041.      #include <unistd.h>
  17042.      
  17043.      int getpagesize(void);
  17044.  
  17045. Description
  17046. -----------
  17047.  
  17048. Return the size of the native virtual memory page size.
  17049.  
  17050. Return Value
  17051. ------------
  17052.  
  17053. 4096 for the i386 and higher processors.
  17054.  
  17055. Portability
  17056. -----------
  17057.  
  17058. not ANSI, not POSIX
  17059.  
  17060. 
  17061. File: libc.info,  Node: getpass,  Next: getpgrp,  Prev: getpagesize,  Up: Alphabetical List
  17062.  
  17063. getpass
  17064. =======
  17065.  
  17066. Syntax
  17067. ------
  17068.  
  17069.      #include <stdlib.h>
  17070.      
  17071.      char * getpass(const char *prompt)
  17072.  
  17073. Description
  17074. -----------
  17075.  
  17076. This function reads up to a Newline (CR or LF) or EOF (Ctrl-D or Ctrl-Z)
  17077. from the standard input, without an echo, after prompting with a
  17078. null-terminated string PROMPT.  It returns the string of at most 8
  17079. characters typed by the user.  Pressing Ctrl-C or Ctrl-Break will cause
  17080. the calling program to `exit(1)'.
  17081.  
  17082. Return Value
  17083. ------------
  17084.  
  17085. A pointer to a static buffer which holds the user's response.  The
  17086. buffer will be overwritten by each new call.  In case of any error in
  17087. the lower I/O routines, a NULL pointer will be returned.
  17088.  
  17089. Portability
  17090. -----------
  17091.  
  17092. not ANSI, not POSIX
  17093.  
  17094. Example
  17095. -------
  17096.  
  17097.      char *password = getpass("Password: ");
  17098.  
  17099. 
  17100. File: libc.info,  Node: getpgrp,  Next: getpid,  Prev: getpass,  Up: Alphabetical List
  17101.  
  17102. getpgrp
  17103. =======
  17104.  
  17105. Syntax
  17106. ------
  17107.  
  17108.      #include <unistd.h>
  17109.      
  17110.      int getpgrp(void);
  17111.  
  17112. Description
  17113. -----------
  17114.  
  17115. Gets the process group, which is currently the same as the pid.
  17116.  
  17117. Return Value
  17118. ------------
  17119.  
  17120. The process group.
  17121.  
  17122. Portability
  17123. -----------
  17124.  
  17125. not ANSI, POSIX
  17126.  
  17127. 
  17128. File: libc.info,  Node: getpid,  Next: getpwent,  Prev: getpgrp,  Up: Alphabetical List
  17129.  
  17130. getpid
  17131. ======
  17132.  
  17133. Syntax
  17134. ------
  17135.  
  17136.      #include <unistd.h>
  17137.      
  17138.      int getpid(void);
  17139.  
  17140. Description
  17141. -----------
  17142.  
  17143. Get the process ID, which uniquely identifies each program running on
  17144. the system.
  17145.  
  17146. Return Value
  17147. ------------
  17148.  
  17149. The process ID.
  17150.  
  17151. Portability
  17152. -----------
  17153.  
  17154. not ANSI, POSIX
  17155.  
  17156. 
  17157. File: libc.info,  Node: getpwent,  Next: getpwnam,  Prev: getpid,  Up: Alphabetical List
  17158.  
  17159. getpwent
  17160. ========
  17161.  
  17162. Syntax
  17163. ------
  17164.  
  17165.      #include <pwd.h>
  17166.      
  17167.      struct passwd *getpwent(void);
  17168.  
  17169. Description
  17170. -----------
  17171.  
  17172. This function retrieves the next available password file entry.  For
  17173. MS-DOS, this is simulated by providing exactly one entry:
  17174.  
  17175.      struct passwd {
  17176.        char * pw_name;    /* getlogin() */
  17177.        int    pw_uid;     /* getuid() */
  17178.        int    pw_gid;     /* getgid() */
  17179.        char * pw_dir;     /* "/" or getenv("HOME") */
  17180.        char * pw_shell;   /* "/bin/sh" or getenv("SHELL") */
  17181.      };
  17182.  
  17183. The `pw_name' member is returned as described under `getlogin' (*note
  17184. getlogin::.).  The `pw_uid' member is returned as described under
  17185. `getuid' (*note getuid::.).  `pw_gid' is returned as described under
  17186. `getgid' (*note getgid::.).  The `pw_dir' member is set to the value of
  17187. the environment variable `HOME' if it is defined, or to `/' otherwise.
  17188. `pw_shell' is set as follows:
  17189.  
  17190.    * If the environment variable `SHELL' is set, the value of `SHELL'.
  17191.  
  17192.    * If `SHELL' is not set, but `COMSPEC' is, the value of `COMSPEC'.
  17193.  
  17194.    * If neither of the above variables is defined, `pw_shell' is set to
  17195.      `"sh"'.
  17196.  
  17197. Return Value
  17198. ------------
  17199.  
  17200. The next passwd entry, or `NULL' if there are no more.
  17201.  
  17202. Portability
  17203. -----------
  17204.  
  17205. not ANSI, not POSIX
  17206.  
  17207. Example
  17208. -------
  17209.  
  17210.      struct passwd *p;
  17211.      setpwent();
  17212.      while ((p = getpwent()) != NULL)
  17213.      {
  17214.        printf("user %s name %s\n", p->pw_name, p->pw_gecos);
  17215.      }
  17216.      endpwent();
  17217.  
  17218. 
  17219. File: libc.info,  Node: getpwnam,  Next: getpwuid,  Prev: getpwent,  Up: Alphabetical List
  17220.  
  17221. getpwnam
  17222. ========
  17223.  
  17224. Syntax
  17225. ------
  17226.  
  17227.      #include <pwd.h>
  17228.      
  17229.      struct passwd *getpwnam(const char *name);
  17230.  
  17231. Description
  17232. -----------
  17233.  
  17234. This function gets the password file entry matching NAME.  See *Note
  17235. getpwent::, for the description of `struct passwd'.
  17236.  
  17237. Return Value
  17238. ------------
  17239.  
  17240. The matching record, or `NULL' if none match.
  17241.  
  17242. Portability
  17243. -----------
  17244.  
  17245. not ANSI, POSIX
  17246.  
  17247. 
  17248. File: libc.info,  Node: getpwuid,  Next: getrlimit,  Prev: getpwnam,  Up: Alphabetical List
  17249.  
  17250. getpwuid
  17251. ========
  17252.  
  17253. Syntax
  17254. ------
  17255.  
  17256.      #include <pwd.h>
  17257.      
  17258.      struct passwd *getpwuid(uid_t uid);
  17259.  
  17260. Description
  17261. -----------
  17262.  
  17263. This function gets the password file entry matching UID.  See *Note
  17264. getpwent::, for the description of `struct passwd'.
  17265.  
  17266. Return Value
  17267. ------------
  17268.  
  17269. The matching record, or `NULL' if none match.
  17270.  
  17271. Portability
  17272. -----------
  17273.  
  17274. not ANSI, POSIX
  17275.  
  17276. 
  17277. File: libc.info,  Node: getrlimit,  Next: getrusage,  Prev: getpwuid,  Up: Alphabetical List
  17278.  
  17279. getrlimit
  17280. =========
  17281.  
  17282. Syntax
  17283. ------
  17284.  
  17285.      #include <sys/resource.h>
  17286.      
  17287.      int getrlimit (int rltype, struct rlimit *rlimitp);
  17288.  
  17289. Description
  17290. -----------
  17291.  
  17292. This function gets the resource limit specified by RLTYPE and stores it
  17293. in the buffer pointed to by RLIMITP.  The `rlimit' structure is defined
  17294. on `sys/resource.h' as follows:
  17295.  
  17296.      struct rlimit {
  17297.        long rlim_cur;  /* current (soft) limit */
  17298.        long rlim_max;  /* maximum value for rlim_cur */
  17299.      };
  17300.  
  17301. The following resource types can be passed in RLTYPE:
  17302.  
  17303. `RLIMIT_CPU'
  17304.      CPU time in milliseconds.
  17305.  
  17306. `RLIMIT_FSIZE'
  17307.      Maximum file size.
  17308.  
  17309. `RLIMIT_DATA'
  17310.      Data size.
  17311.  
  17312. `RLIMIT_STACK'
  17313.      Stack size.
  17314.  
  17315. `RLIMIT_CORE'
  17316.      Core file size.
  17317.  
  17318. `RLIMIT_RSS'
  17319.      Resident set size.
  17320.  
  17321. `RLIMIT_MEMLOCK'
  17322.      Locked-in-memory address space.
  17323.  
  17324. `RLIMIT_NPROC'
  17325.      Number of processes.
  17326.  
  17327. `RLIMIT_NOFILE'
  17328.      Number of open files.
  17329.  
  17330. Currently, only the `RLIMIT_STACK' and `RLIMIT_NOFILE' are meaningful:
  17331. the first returns the value of `_stklen' (*note _stklen::.), the second
  17332. the value returned by `sysconf(_SC_OPEN_MAX)' (*note sysconf::.).  All
  17333. other members of the `rlimit' structure are set to `RLIM_INFINITY',
  17334. defined in `sys/resource.h' as `2^31 - 1'.
  17335.  
  17336. Return Value
  17337. ------------
  17338.  
  17339. Zero on success, nonzero on failure.
  17340.  
  17341. Portability
  17342. -----------
  17343.  
  17344. not ANSI, not POSIX
  17345.  
  17346. Example
  17347. -------
  17348.  
  17349.      struct rlimit rlimitbuf;
  17350.      int rc = getrlimit (RLIMIT_STACK, &rlimitbuf);
  17351.  
  17352. 
  17353. File: libc.info,  Node: getrusage,  Next: gets,  Prev: getrlimit,  Up: Alphabetical List
  17354.  
  17355. getrusage
  17356. =========
  17357.  
  17358. Syntax
  17359. ------
  17360.  
  17361.      #include <sys/time.h>
  17362.      #include <sys/resource.h>
  17363.      
  17364.      int getrusage(int who, struct rusage *rusage);
  17365.  
  17366. Description
  17367. -----------
  17368.  
  17369. This function returns information about the running process.  The
  17370. structure `struct rusage' is defined on `<sys/resource.h>' as follows:
  17371.  
  17372.        struct rusage {
  17373.          struct timeval ru_utime;    /* user time used */
  17374.          struct timeval ru_stime;    /* system time used */
  17375.          long ru_maxrss;        /* integral max resident set size */
  17376.          long ru_ixrss;        /* integral shared text memory size */
  17377.          long ru_idrss;        /* integral unshared data size */
  17378.          long ru_isrss;        /* integral unshared stack size */
  17379.          long ru_minflt;        /* page reclaims */
  17380.          long ru_majflt;        /* page faults */
  17381.          long ru_nswap;        /* swaps */
  17382.          long ru_inblock;        /* block input operations */
  17383.          long ru_oublock;        /* block output operations */
  17384.          long ru_msgsnd;        /* messages sent */
  17385.          long ru_msgrcv;        /* messages received */
  17386.          long ru_nsignals;        /* signals received */
  17387.          long ru_nvcsw;        /* voluntary context switches */
  17388.          long ru_nivcsw;        /* involuntary context switches */
  17389.        };
  17390.  
  17391. Currently, the only field that is computed is `ru_utime'.  It is
  17392. computed as the total elapsed time used by the calling program.  The
  17393. remainder of the fields are set to zero.
  17394.  
  17395. The WHO parameter must be `RUSAGE_SELF' or `RUSAGE_CHILDREN'.
  17396.  
  17397. Return Value
  17398. ------------
  17399.  
  17400. Zero on success, nonzero on failure.
  17401.  
  17402. Portability
  17403. -----------
  17404.  
  17405. not ANSI, not POSIX
  17406.  
  17407. Example
  17408. -------
  17409.  
  17410.      struct rusage r;
  17411.      getrusage(RUSAGE_SELF, &r);
  17412.  
  17413. 
  17414. File: libc.info,  Node: gets,  Next: gettext,  Prev: getrusage,  Up: Alphabetical List
  17415.  
  17416. gets
  17417. ====
  17418.  
  17419. Syntax
  17420. ------
  17421.  
  17422.      #include <stdio.h>
  17423.      
  17424.      char *gets(char *buffer);
  17425.  
  17426. Description
  17427. -----------
  17428.  
  17429. Reads characters from `stdin', storing them in BUFFER, until either end
  17430. of file or a newline is encountered.  If any characters were stored,
  17431. the BUFFER is then `NULL' terminated and its address is returned, else
  17432. `NULL' is returned.
  17433.  
  17434. Return Value
  17435. ------------
  17436.  
  17437. The address of the buffer, or `NULL'.
  17438.  
  17439. Portability
  17440. -----------
  17441.  
  17442. ANSI, POSIX
  17443.  
  17444. Example
  17445. -------
  17446.  
  17447.      char buf[1000];
  17448.      while (gets(buf))
  17449.        puts(buf);
  17450.  
  17451. 
  17452. File: libc.info,  Node: gettext,  Next: gettextinfo,  Prev: gets,  Up: Alphabetical List
  17453.  
  17454. gettext
  17455. =======
  17456.  
  17457. Syntax
  17458. ------
  17459.  
  17460.      #include <conio.h>
  17461.      
  17462.      int     gettext(int _left, int _top, int _right, int _bottom, void *_destin);
  17463.  
  17464. Description
  17465. -----------
  17466.  
  17467. Retrieve a block of screen characters into a buffer.
  17468.  
  17469. Return Value
  17470. ------------
  17471.  
  17472. 1
  17473.  
  17474. Portability
  17475. -----------
  17476.  
  17477. not ANSI, not POSIX
  17478.  
  17479. 
  17480. File: libc.info,  Node: gettextinfo,  Next: gettime,  Prev: gettext,  Up: Alphabetical List
  17481.  
  17482. gettextinfo
  17483. ===========
  17484.  
  17485. Syntax
  17486. ------
  17487.  
  17488.      #include <conio.h>
  17489.      
  17490.      void    gettextinfo(struct text_info *_r);
  17491.  
  17492. Description
  17493. -----------
  17494.  
  17495. This function returns the parameters of the current window on the
  17496. screen.  The return structure is this:
  17497.  
  17498.      struct text_info {
  17499.          unsigned char winleft;
  17500.          unsigned char wintop;
  17501.          unsigned char winright;
  17502.          unsigned char winbottom;
  17503.          unsigned char attribute;
  17504.          unsigned char normattr;
  17505.          unsigned char currmode;
  17506.          unsigned char screenheight;
  17507.          unsigned char screenwidth;
  17508.          unsigned char curx;
  17509.          unsigned char cury;
  17510.      };
  17511.  
  17512. The `normattr' field is the text attribute which was in effect before
  17513. the program started.
  17514.  
  17515. Portability
  17516. -----------
  17517.  
  17518. not ANSI, not POSIX
  17519.  
  17520. 
  17521. File: libc.info,  Node: gettime,  Next: gettimeofday,  Prev: gettextinfo,  Up: Alphabetical List
  17522.  
  17523. gettime
  17524. =======
  17525.  
  17526. Syntax
  17527. ------
  17528.  
  17529.      #include <dos.h>
  17530.      
  17531.      void gettime(struct time *);
  17532.  
  17533. Description
  17534. -----------
  17535.  
  17536. This function gets the current time.  The return structure is as
  17537. follows:
  17538.  
  17539.      struct time {
  17540.        unsigned char ti_min;
  17541.        unsigned char ti_hour;
  17542.        unsigned char ti_hund;
  17543.        unsigned char ti_sec;
  17544.      };
  17545.  
  17546. *Note settime::. *Note getdate::.
  17547.  
  17548. Return Value
  17549. ------------
  17550.  
  17551. None.
  17552.  
  17553. Portability
  17554. -----------
  17555.  
  17556. not ANSI, not POSIX
  17557.  
  17558. Example
  17559. -------
  17560.  
  17561.      struct time t;
  17562.      gettime(&t);
  17563.  
  17564. 
  17565. File: libc.info,  Node: gettimeofday,  Next: getuid,  Prev: gettime,  Up: Alphabetical List
  17566.  
  17567. gettimeofday
  17568. ============
  17569.  
  17570. Syntax
  17571. ------
  17572.  
  17573.      #include <time.h>
  17574.      
  17575.      int gettimeofday(struct timeval *tp, struct timezone *tzp);
  17576.  
  17577. Description
  17578. -----------
  17579.  
  17580. Gets the current GMT time and the local timezone information.  The
  17581. return structures are as follows:
  17582.  
  17583.      struct timeval {
  17584.        long tv_sec;  /* seconds since 00:00:00 GMT 1/1/1970 */
  17585.        long tv_usec; /* microseconds */
  17586.      };
  17587.      struct timezone {
  17588.        int tz_minuteswest; /* west of GMT */
  17589.        int tz_dsttime;     /* set if daylight saving time in affect */
  17590.      };
  17591.  
  17592. If either TP or TZP are `NULL', that information is not provided.
  17593.  
  17594. Note that although this function returns microseconds for compatibility
  17595. reasons, the values are precise to less than 1/20 of a second only.
  17596. The underlying DOS function has 1/20 second granularity, as it is
  17597. calculated from the 55 ms timer tick count, so you won't get better than
  17598. that with gettimeofday().
  17599.  
  17600. *Note settimeofday::.
  17601.  
  17602. Return Value
  17603. ------------
  17604.  
  17605. Zero on success, nonzero on failure.
  17606.  
  17607. Portability
  17608. -----------
  17609.  
  17610. not ANSI, not POSIX
  17611.  
  17612. 
  17613. File: libc.info,  Node: getuid,  Next: getw,  Prev: gettimeofday,  Up: Alphabetical List
  17614.  
  17615. getuid
  17616. ======
  17617.  
  17618. Syntax
  17619. ------
  17620.  
  17621.      #include <unistd.h>
  17622.      
  17623.      int getuid(void);
  17624.  
  17625. Description
  17626. -----------
  17627.  
  17628. Returns the user ID.
  17629.  
  17630. Return Value
  17631. ------------
  17632.  
  17633. 42
  17634.  
  17635. Portability
  17636. -----------
  17637.  
  17638. not ANSI, POSIX
  17639.  
  17640. 
  17641. File: libc.info,  Node: getw,  Next: getwd,  Prev: getuid,  Up: Alphabetical List
  17642.  
  17643. getw
  17644. ====
  17645.  
  17646. Syntax
  17647. ------
  17648.  
  17649.      #include <stdio.h>
  17650.      
  17651.      int getw(FILE *file);
  17652.  
  17653. Description
  17654. -----------
  17655.  
  17656. Reads a single binary word in native format from FILE.
  17657.  
  17658. *Note putw::.
  17659.  
  17660. Return Value
  17661. ------------
  17662.  
  17663. The value read, or `EOF' for end-of-file or error.  Since `EOF' is a
  17664. valid integer, you should use `feof' or `ferror' to detect this
  17665. situation.
  17666.  
  17667. Portability
  17668. -----------
  17669.  
  17670. not ANSI, not POSIX
  17671.  
  17672. Example
  17673. -------
  17674.  
  17675.      int i = getw(stdin);
  17676.  
  17677. 
  17678. File: libc.info,  Node: getwd,  Next: getxkey,  Prev: getw,  Up: Alphabetical List
  17679.  
  17680. getwd
  17681. =====
  17682.  
  17683. Syntax
  17684. ------
  17685.  
  17686.      #include <unistd.h>
  17687.      
  17688.      char *getwd(char *buffer);
  17689.  
  17690. Description
  17691. -----------
  17692.  
  17693. Get the current directory and put it in BUFFER.  The return value
  17694. includes the drive specifier.
  17695.  
  17696. Return Value
  17697. ------------
  17698.  
  17699. BUFFER is returned.
  17700.  
  17701. Portability
  17702. -----------
  17703.  
  17704. not ANSI, not POSIX
  17705.  
  17706. Example
  17707. -------
  17708.  
  17709.      char buf[PATH_MAX];
  17710.      getwd(buf);
  17711.  
  17712. 
  17713. File: libc.info,  Node: getxkey,  Next: glob,  Prev: getwd,  Up: Alphabetical List
  17714.  
  17715. getxkey
  17716. =======
  17717.  
  17718. Syntax
  17719. ------
  17720.  
  17721.      #include <pc.h>
  17722.      #include <keys.h>
  17723.      
  17724.      int getxkey(void);
  17725.  
  17726. Description
  17727. -----------
  17728.  
  17729. Waits for the user to press one key, then returns that key.  Alt-key
  17730. combinations have 0x100 added to them, and extended keys have 0x200
  17731. added to them.
  17732.  
  17733. The file `keys.h' has symbolic names for many of the keys.
  17734.  
  17735. *Note getkey::.
  17736.  
  17737. Return Value
  17738. ------------
  17739.  
  17740. The key pressed.
  17741.  
  17742. Portability
  17743. -----------
  17744.  
  17745. not ANSI, not POSIX
  17746.  
  17747. Example
  17748. -------
  17749.  
  17750.      while (getxkey() != K_EEnd)
  17751.        do_something();
  17752.  
  17753. 
  17754. File: libc.info,  Node: glob,  Next: globfree,  Prev: getxkey,  Up: Alphabetical List
  17755.  
  17756. glob
  17757. ====
  17758.  
  17759. Syntax
  17760. ------
  17761.  
  17762.      #include <glob.h>
  17763.      
  17764.      int  glob(const char *pattern, int flags,
  17765.                int (*errfunc)(const char *epath, int eerrno), glob_t *pglob);
  17766.  
  17767. Description
  17768. -----------
  17769.  
  17770. This function expands a filename wildcard which is passed as PATTERN.
  17771. The pattern may include these special characters:
  17772.  
  17773. `*'
  17774.      Matches zero of more characters.
  17775.  
  17776. `?'
  17777.      Matches exactly one character (any character).
  17778.  
  17779. `[...]'
  17780.      Matches one character from a group of characters.  If the first
  17781.      character is `!', matches any character *not* in the group.  A
  17782.      group is defined as a list of characters between the brackets,
  17783.      e.g. `[dkl_]', or by two characters separated by `-' to indicate
  17784.      all characters between and including these two.  For example,
  17785.      `[a-d]' matches `a', `b', `c', or `d', and `[!a-zA-Z0-9]' matches
  17786.      any character that is not alphanumeric.
  17787.  
  17788. `...'
  17789.      Matches all the subdirectories, recursively (VMS aficionados,
  17790.      rejoice!).
  17791.  
  17792. `\'
  17793.      Causes the next character to not be treated as special.  For
  17794.      example, `\[' matches a literal `['.  If FLAGS includes
  17795.      `GLOB_NOESCAPE', this quoting is disabled and `\' is handled as a
  17796.      simple character.
  17797.  
  17798. The variable FLAGS controls certain options of the expansion process.
  17799. Possible values for _FLAGS are as follows:
  17800.  
  17801. `GLOB_APPEND'
  17802.      Append the matches to those already present in the array
  17803.      `pglob->gl_pathv'.  By default, `glob' discards all previous
  17804.      contents of `pglob->gl_pathv' and allocates a new memory block for
  17805.      it.  If you use `GLOB_APPEND', `pglob' should point to a structure
  17806.      returned by a previous call to `glob'.
  17807.  
  17808. `GLOB_DOOFFS'
  17809.      Skip `pglob->gl_offs' entries in `gl_pathv' and put new matches
  17810.      after that point.  By default, `glob' puts the new matches
  17811.      beginning at `pglob->gl_pathv[0]'.  You can use this flag both with
  17812.      `GLOB_APPEND' (in which case the new matches will be put after the
  17813.      first `pglob->gl_offs' matches from previous call to `glob'), or
  17814.      without it (in which case the first `pglob->gl_offs' entries in
  17815.      `pglob->gl_pathv' will be filled by `NULL' pointers).
  17816.  
  17817. `GLOB_ERR'
  17818.      Stop when an unreadable directory is encountered and call
  17819.      user-defined function ERRFUNC.  This cannot happen under DOS (and
  17820.      thus ERRFUNC is never used).
  17821.  
  17822. `GLOB_MARK'
  17823.      Append a slash to each pathname that is a directory.
  17824.  
  17825. `GLOB_NOCHECK'
  17826.      If no matches are found, return the pattern itself as the only
  17827.      match.  By default, `glob' doesn't change `pglob' if no matches are
  17828.      found.
  17829.  
  17830. `GLOB_NOESCAPE'
  17831.      Disable blackslash as an escape character.  By default, backslash
  17832.      quotes special meta-characters in wildcards described above.
  17833.  
  17834. `GLOB_NOSORT'
  17835.      Do not sort the returned list.  By default, the list is sorted
  17836.      alphabetically.  This flag causes the files to be returned in the
  17837.      order they were found in the directory.
  17838.  
  17839. Given the pattern and the flags, `glob' expands the pattern and returns
  17840. a list of files that match the pattern in a structure a pointer to
  17841. which is passed via PGLOB.  This structure is like this:
  17842.  
  17843.      typedef struct {
  17844.        size_t gl_pathc;
  17845.        char **gl_pathv;
  17846.        size_t gl_offs;
  17847.      } glob_t;
  17848.  
  17849. In the structure, the `gl_pathc' field holds the number of filenames in
  17850. `gl_pathv' list; this includes the filenames produced by this call,
  17851. plus any previous filenames if `GLOB_APPEND' or `GLOB_DOOFFS' were set
  17852. in FLAGS.  The list of matches is returned as an array of pointers to
  17853. the filenames; `gl_pathv' holds the address of the array.  Thus, the
  17854. filenames which match the pattern can be accessed as `gl_pathv[0]',
  17855. `gl_pathv[1]', etc.  If `GLOB_DOOFFS' was set in FLAGS, the new matches
  17856. begin at offset given by `gl_offs'.
  17857.  
  17858. Return Value
  17859. ------------
  17860.  
  17861. Zero on success, or one of these codes:
  17862.  
  17863. `GLOB_ABORTED'
  17864.      Not used in DJGPP implementation.
  17865.  
  17866. `GLOB_NOMATCH'
  17867.      No files matched the given pattern.
  17868.  
  17869. `GLOB_NOSPACE'
  17870.      Not enough memory to accomodate expanded filenames.
  17871.  
  17872. `GLOB_ERR'
  17873.      Never happens on MSDOS, see above.
  17874.  
  17875. Notes
  17876. -----
  17877.  
  17878. `glob' will not match names of volume labels.
  17879.  
  17880. On MSDOS, filenames are always matched case-insensitively.  On
  17881. filesystems that preserve letter-case in filenames (such as Windows 9x),
  17882. matches are case-insensitive unless the pattern includes uppercase
  17883. characters.
  17884.  
  17885. On MSDOS, the list of expanded filenames will be returned in lower case,
  17886. if all the characters of the pattern (except those between brackets
  17887. [...]) are lower-case; if some of them are upper-case, the expanded
  17888. filenames will be also in upper case.  On filesystems that preserve
  17889. letter-case in filenames, long filenames are returned as they are found
  17890. in the directory entry; DOS-style 8+3 filenames are returned as on MSDOS
  17891. (in lower case if the pattern doesn't include any upper-case letters, in
  17892. upper case otherwise).
  17893.  
  17894. When the environment variable `LFN' is set to `n', `glob' behaves on
  17895. Windows 9x exactly as it does on MSDOS.
  17896.  
  17897. Setting the environment variable `FNCASE' to `y', or setting the
  17898. `_CRT0_FLAG_PRESERVE_FILENAME_CASE' bit in the `_crt0_startup_flags'
  17899. variable (*note _crt0_startup_flags::.)  suppresses any letter-case
  17900. conversions in filenames and forces case-sensitive filename matching.
  17901. *Note _preserve_fncase::.
  17902.  
  17903. Portability
  17904. -----------
  17905.  
  17906. not ANSI, POSIX
  17907.  
  17908. Example
  17909. -------
  17910.  
  17911.  
  17912.      #include <stdlib.h>
  17913.      #include <string.h>
  17914.      #include <glob.h>
  17915.      
  17916.      /* Convert a wildcard pattern into a list of blank-separated
  17917.         filenames which match the wildcard.  */
  17918.      
  17919.      char * glob_pattern(char *wildcard)
  17920.      {
  17921.        char *gfilename;
  17922.        size_t cnt, length;
  17923.        glob_t glob_results;
  17924.        char **p;
  17925.      
  17926.        glob(wildcard, GLOB_NOCHECK, 0, &glob_results);
  17927.      
  17928.        /* How much space do we need?  */
  17929.        for (p = glob_results.gl_pathv, cnt = glob_results.gl_pathc;
  17930.             cnt; p++, cnt--)
  17931.          length += strlen(*p) + 1;
  17932.      
  17933.        /* Allocate the space and generate the list.  */
  17934.        gfilename = (char *) calloc(length, sizeof(char));
  17935.        for (p = glob_results.gl_pathv, cnt = glob_results.gl_pathc;
  17936.             cnt; p++, cnt--)
  17937.          {
  17938.            strcat(gfilename, *p);
  17939.            if (cnt > 1)
  17940.              strcat(gfilename, " ");
  17941.          }
  17942.      
  17943.        globfree(&glob_results);
  17944.        return gfilename;
  17945.      }
  17946.  
  17947. 
  17948. File: libc.info,  Node: globfree,  Next: gmtime,  Prev: glob,  Up: Alphabetical List
  17949.  
  17950. globfree
  17951. ========
  17952.  
  17953. Syntax
  17954. ------
  17955.  
  17956.      #include <glob.h>
  17957.      
  17958.      void globfree(glob_t *_pglob);
  17959.  
  17960. Description
  17961. -----------
  17962.  
  17963. Frees the memory associated with `_pglob'.
  17964.  
  17965. Portability
  17966. -----------
  17967.  
  17968. not ANSI, POSIX
  17969.  
  17970. 
  17971. File: libc.info,  Node: gmtime,  Next: _go32_conventional_mem_selector,  Prev: globfree,  Up: Alphabetical List
  17972.  
  17973. gmtime
  17974. ======
  17975.  
  17976. Syntax
  17977. ------
  17978.  
  17979.      #include <time.h>
  17980.      
  17981.      struct tm *gmtime(const time_t *tod);
  17982.  
  17983. Description
  17984. -----------
  17985.  
  17986. Converts the time represented by TOD into a structure.
  17987.  
  17988. The return structure has this format:
  17989.  
  17990.      struct tm {
  17991.        int    tm_sec;    /* seconds after the minute [0-60] */
  17992.        int    tm_min;    /* minutes after the hour [0-59] */
  17993.        int    tm_hour;   /* hours since midnight [0-23] */
  17994.        int    tm_mday;   /* day of the month [1-31] */
  17995.        int    tm_mon;    /* months since January [0-11] */
  17996.        int    tm_year;   /* years since 1900 */
  17997.        int    tm_wday;   /* days since Sunday [0-6] */
  17998.        int    tm_yday;   /* days since January 1 [0-365] */
  17999.        int    tm_isdst;  /* Daylight Savings Time flag */
  18000.        long   tm_gmtoff; /* offset from GMT in seconds */
  18001.        char * tm_zone;   /* timezone abbreviation */
  18002.      };
  18003.  
  18004. Return Value
  18005. ------------
  18006.  
  18007. A pointer to a static structure which is overwritten with each call.
  18008.  
  18009. Portability
  18010. -----------
  18011.  
  18012. ANSI, POSIX
  18013.  
  18014. Example
  18015. -------
  18016.  
  18017.      time_t x;
  18018.      struct tm *t;
  18019.      time(&x);
  18020.      t = gmtime(&t);
  18021.  
  18022. 
  18023. File: libc.info,  Node: _go32_conventional_mem_selector,  Next: _go32_dpmi_allocate_dos_memory,  Prev: gmtime,  Up: Alphabetical List
  18024.  
  18025. _go32_conventional_mem_selector
  18026. ===============================
  18027.  
  18028. Syntax
  18029. ------
  18030.  
  18031.      #include <go32.h>
  18032.      
  18033.      u_short _go32_conventional_mem_selector();
  18034.  
  18035. Description
  18036. -----------
  18037.  
  18038. This function returns a selector which has a physical base address
  18039. corresponding to the beginning of conventional memory.  This selector
  18040. can be used as a parameter to `movedata' (*note movedata::.) to
  18041. manipulate memory in the conventional address space.
  18042.  
  18043. Return Value
  18044. ------------
  18045.  
  18046. The selector.
  18047.  
  18048. Portability
  18049. -----------
  18050.  
  18051. not ANSI, not POSIX
  18052.  
  18053. Example
  18054. -------
  18055.  
  18056.      short blank_row_buf[ScreenCols()];
  18057.      /* scroll screen */
  18058.      movedata(_go32_conventional_mem_selector(), 0xb8000 + ScreenCols()*2,
  18059.               _go32_conventional_mem_selector(), 0xb8000,
  18060.               ScreenCols() * (ScreenRows()-1) * 2);
  18061.      /* fill last row */
  18062.      movedata(_go32_my_ds, (int)blank_row_buf,
  18063.               _go32_conventional_mem_selector(),
  18064.                  0xb8000 + ScreenCols()*(ScreenRows()-1)*2,
  18065.                ScreenCols() * 2);
  18066.  
  18067. 
  18068. File: libc.info,  Node: _go32_dpmi_allocate_dos_memory,  Next: _go32_dpmi_allocate_iret_wrapper,  Prev: _go32_conventional_mem_selector,  Up: Alphabetical List
  18069.  
  18070. _go32_dpmi_allocate_dos_memory
  18071. ==============================
  18072.  
  18073. Syntax
  18074. ------
  18075.  
  18076.      #include <dpmi.h>
  18077.      
  18078.      int _go32_dpmi_allocate_dos_memory(_go32_dpmi_seginfo *info);
  18079.  
  18080. Description
  18081. -----------
  18082.  
  18083. *Note DPMI Overview::.
  18084.  
  18085. Allocate a part of the conventional memory area (the first 640K).  Set
  18086. the `size' field of INFO to the number of paragraphs requested (this is
  18087. (size in bytes + 15)/16), then call.  The `rm_segment' field of INFO
  18088. contains the segment of the allocated memory.
  18089.  
  18090. The memory may be resized with `_go32_dpmi_resize_dos_memory' and must
  18091. be freed with `_go32_dpmi_free_dos_memory'.
  18092.  
  18093. If there isn't enough memory in the system, the `size' field of INFO
  18094. has the largest available size, and an error is returned.
  18095.  
  18096. See also *Note dosmemput::, and *Note dosmemget::.
  18097.  
  18098. Return Value
  18099. ------------
  18100.  
  18101. Zero on success, nonzero on failure.
  18102.  
  18103. Portability
  18104. -----------
  18105.  
  18106. not ANSI, not POSIX
  18107.  
  18108. Example
  18109. -------
  18110.  
  18111.      _go32_dpmi_seginfo info;
  18112.      info.size = (want_size+15) / 16;
  18113.      _go32_dpmi_allocate_dos_memory(&info);
  18114.      dosmemput(buffer, want_size, info.rm_segment*16);
  18115.      _go32_dpmi_free_dos_memory(&info);
  18116.  
  18117. 
  18118. File: libc.info,  Node: _go32_dpmi_allocate_iret_wrapper,  Next: _go32_dpmi_allocate_real_mode_callback_iret,  Prev: _go32_dpmi_allocate_dos_memory,  Up: Alphabetical List
  18119.  
  18120. _go32_dpmi_allocate_iret_wrapper
  18121. ================================
  18122.  
  18123. Syntax
  18124. ------
  18125.  
  18126.      #include <dpmi.h>
  18127.      
  18128.      int _go32_dpmi_allocate_iret_wrapper(_go32_dpmi_seginfo *info);
  18129.  
  18130. Description
  18131. -----------
  18132.  
  18133. *Note DPMI Overview::.
  18134.  
  18135. This function creates a small assembler function that handles the
  18136. overhead of servicing an interrupt.  To use, put the address of your
  18137. servicing function in the `pm_offset' field of INFO and call this
  18138. function.  The `pm_field' will get replaced with the address of the
  18139. wrapper function, which you pass to both
  18140. `_go32_dpmi_set_protected_mode_interrupt_vector' and
  18141. `_go32_dpmi_free_iret_wrapper'.
  18142.  
  18143. See also *Note _go32_dpmi_set_protected_mode_interrupt_vector::, and
  18144. *Note _go32_dpmi_free_iret_wrapper::.
  18145.  
  18146. Return Value
  18147. ------------
  18148.  
  18149. Zero on success, nonzero on failure.
  18150.  
  18151. Portability
  18152. -----------
  18153.  
  18154. not ANSI, not POSIX
  18155.  
  18156. Example
  18157. -------
  18158.  
  18159.      _go32_dpmi_seginfo info;
  18160.      info.pm_offset = my_handler;
  18161.      _go32_dpmi_allocate_iret_wrapper(&info);
  18162.      _go32_dpmi_set_protected_mode_interrupt_handler(0x75, &info);
  18163.      ...
  18164.      _go32_dpmi_free_iret_wrapper(&info);
  18165.  
  18166. 
  18167. File: libc.info,  Node: _go32_dpmi_allocate_real_mode_callback_iret,  Next: _go32_dpmi_allocate_real_mode_callback_retf,  Prev: _go32_dpmi_allocate_iret_wrapper,  Up: Alphabetical List
  18168.  
  18169. _go32_dpmi_allocate_real_mode_callback_iret
  18170. ===========================================
  18171.  
  18172. Syntax
  18173. ------
  18174.  
  18175.      #include <dpmi.h>
  18176.      
  18177.      int _go32_dpmi_allocate_real_mode_callback_iret(_go32_dpmi_seginfo *info, _go32_dpmi_registers *regs);
  18178.  
  18179. Description
  18180. -----------
  18181.  
  18182. *Note DPMI Overview::.
  18183.  
  18184. This function allocates a "real-mode callback".  Fill in the
  18185. `pm_offset' field of INFO and call this function.  It will fill in the
  18186. `rm_segment' and `rm_offset' fields.  Any time a real-mode program
  18187. calls the real-mode address, your function gets called.  The registers
  18188. in effect will be stored in REGS, which should be a global, and will be
  18189. passed to your function.  Any changes in REGS will be reflected back
  18190. into real mode.  A wrapper will be added to your function to simulate
  18191. the effects of an `iret' instruction, so this function is useful for
  18192. trapping real-mode software interrupts (like 0x1b - `Ctrl-<Break>' hit).
  18193.  
  18194. Return Value
  18195. ------------
  18196.  
  18197. Zero on success, nonzero on failure.
  18198.  
  18199. Portability
  18200. -----------
  18201.  
  18202. not ANSI, not POSIX
  18203.  
  18204. Example
  18205. -------
  18206.  
  18207.      _go32_dpmi_registers regs;
  18208.      
  18209.      my_handler(_go32_dpmi_registers *r)
  18210.      {
  18211.        r->d.eax = 4;
  18212.      }
  18213.      
  18214.      setup()
  18215.      {
  18216.        _go32_dpmi_seginfo info;
  18217.        _go32_dpmi_seginfo old_vector;
  18218.        _go32_dpmi_get_real_mode_interrupt_vector(0x84, &old_vector);
  18219.        info.pm_offset = my_handler;
  18220.        _go32_dpmi_allocate_real_mode_callback_iret(&info, ®s);
  18221.        _go32_dpmi_set_real_mode_interrupt_vector(0x84, &info);
  18222.        do_stuff();
  18223.        _go32_dpmi_set_real_mode_interrupt_vector(0x84, &old_vector);
  18224.        _go32_dpmi_free_real_mode_callback(&info);
  18225.      }
  18226.  
  18227. 
  18228. File: libc.info,  Node: _go32_dpmi_allocate_real_mode_callback_retf,  Next: _go32_dpmi_chain_protected_mode_interrupt_vector,  Prev: _go32_dpmi_allocate_real_mode_callback_iret,  Up: Alphabetical List
  18229.  
  18230. _go32_dpmi_allocate_real_mode_callback_retf
  18231. ===========================================
  18232.  
  18233. Syntax
  18234. ------
  18235.  
  18236.      #include <dpmi.h>
  18237.      
  18238.      int _go32_dpmi_allocate_real_mode_callback_retf(_go32_dpmi_seginfo *info, _go32_dpmi_registers *regs);
  18239.  
  18240. Description
  18241. -----------
  18242.  
  18243. *Note DPMI Overview::.
  18244.  
  18245. This function allocates a "real-mode callback".  Fill in the
  18246. `pm_offset' field of INFO and call this function.  It will fill in the
  18247. `rm_segment' and `rm_offset' fields.  Any time a real-mode program
  18248. calls the real-mode address, your function gets called.  The registers
  18249. in effect will be stored in REGS, which should be a global, and will be
  18250. passed to your function.  Any changes in REGS will be reflected back
  18251. into real mode.  A wrapper will be added to your function to simulate
  18252. the effects of a far return, such as the callback for the packet driver
  18253. receiver.
  18254.  
  18255. Return Value
  18256. ------------
  18257.  
  18258. Zero on success, nonzero on failure.
  18259.  
  18260. Portability
  18261. -----------
  18262.  
  18263. not ANSI, not POSIX
  18264.  
  18265. Example
  18266. -------
  18267.  
  18268. *Note _go32_dpmi_allocate_real_mode_callback_iret::, for an example of
  18269. usage.
  18270.  
  18271. 
  18272. File: libc.info,  Node: _go32_dpmi_chain_protected_mode_interrupt_vector,  Next: _go32_dpmi_free_dos_memory,  Prev: _go32_dpmi_allocate_real_mode_callback_retf,  Up: Alphabetical List
  18273.  
  18274. _go32_dpmi_chain_protected_mode_interrupt_vector
  18275. ================================================
  18276.  
  18277. Syntax
  18278. ------
  18279.  
  18280.      #include <dpmi.h>
  18281.      
  18282.      int _go32_dpmi_chain_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  18283.  
  18284. Description
  18285. -----------
  18286.  
  18287. *Note DPMI Overview::.
  18288.  
  18289. This function is used to chain a protected mode interrupt.  It will
  18290. build a suitable wrapper that will call your function and then jump to
  18291. the next handler.  Your function need not perform any special handling.
  18292.  
  18293. *Warning!* Because of the way DPMI works, you may *not* `longjmp' out
  18294. of an interrupt handler or perform any system calls (such as `printf')
  18295. from within an interrupt handler.
  18296.  
  18297. Return Value
  18298. ------------
  18299.  
  18300. Zero on success, nonzero on failure.
  18301.  
  18302. Portability
  18303. -----------
  18304.  
  18305. not ANSI, not POSIX
  18306.  
  18307. Example
  18308. -------
  18309.  
  18310. *Note _go32_dpmi_set_protected_mode_interrupt_vector::.
  18311.  
  18312. 
  18313. File: libc.info,  Node: _go32_dpmi_free_dos_memory,  Next: _go32_dpmi_free_iret_wrapper,  Prev: _go32_dpmi_chain_protected_mode_interrupt_vector,  Up: Alphabetical List
  18314.  
  18315. _go32_dpmi_free_dos_memory
  18316. ==========================
  18317.  
  18318. Syntax
  18319. ------
  18320.  
  18321.      #include <dpmi.h>
  18322.      
  18323.      int _go32_dpmi_free_dos_memory(_go32_dpmi_seginfo *info);
  18324.  
  18325. Description
  18326. -----------
  18327.  
  18328. *Note DPMI Overview::.
  18329.  
  18330. This function frees the conventional memory allocated by
  18331. `_go32_dpmi_allocate_real_mode_memory'.  You should pass it the same
  18332. structure as was used to allocate it.
  18333.  
  18334. Return Value
  18335. ------------
  18336.  
  18337. Zero on success, nonzero on failure.
  18338.  
  18339. Portability
  18340. -----------
  18341.  
  18342. not ANSI, not POSIX
  18343.  
  18344. Example
  18345. -------
  18346.  
  18347.      _go32_dpmi_seginfo info;
  18348.      info.size = 100;
  18349.      _go32_dpmi_allocate_dos_memory(&info);
  18350.      _go32_dpmi_free_dos_memory(&info);
  18351.  
  18352. 
  18353. File: libc.info,  Node: _go32_dpmi_free_iret_wrapper,  Next: _go32_dpmi_free_real_mode_callback,  Prev: _go32_dpmi_free_dos_memory,  Up: Alphabetical List
  18354.  
  18355. _go32_dpmi_free_iret_wrapper
  18356. ============================
  18357.  
  18358. Syntax
  18359. ------
  18360.  
  18361.      #include <dpmi.h>
  18362.      
  18363.      int _go32_dpmi_free_iret_wrapper(_go32_dpmi_seginfo *info);
  18364.  
  18365. Description
  18366. -----------
  18367.  
  18368. *Note DPMI Overview::.
  18369.  
  18370. This function frees the memory used by the wrapper created by
  18371. `_go32_dpmi_allocate_iret_wrapper'.  You should not free a wrapper that
  18372. is still in use.
  18373.  
  18374. Return Value
  18375. ------------
  18376.  
  18377. Zero on success, nonzero on failure.
  18378.  
  18379. Portability
  18380. -----------
  18381.  
  18382. not ANSI, not POSIX
  18383.  
  18384. Example
  18385. -------
  18386.  
  18387. *Note _go32_dpmi_allocate_iret_wrapper::.
  18388.  
  18389. 
  18390. File: libc.info,  Node: _go32_dpmi_free_real_mode_callback,  Next: _go32_dpmi_get_free_memory_information,  Prev: _go32_dpmi_free_iret_wrapper,  Up: Alphabetical List
  18391.  
  18392. _go32_dpmi_free_real_mode_callback
  18393. ==================================
  18394.  
  18395. Syntax
  18396. ------
  18397.  
  18398.      #include <dpmi.h>
  18399.      
  18400.      int _go32_dpmi_free_real_mode_callback(_go32_dpmi_seginfo *info);
  18401.  
  18402. Description
  18403. -----------
  18404.  
  18405. *Note DPMI Overview::.
  18406.  
  18407. This function frees the real-mode callbacks and wrappers allocated by
  18408. `_go32_dpmi_allocate_real_mode_callback_iret' and
  18409. `_go32_dpmi_allocate_real_mode_callback_retf'.
  18410.  
  18411. Return Value
  18412. ------------
  18413.  
  18414. Zero on success, nonzero on failure.
  18415.  
  18416. Portability
  18417. -----------
  18418.  
  18419. not ANSI, not POSIX
  18420.  
  18421. Example
  18422. -------
  18423.  
  18424. *Note _go32_dpmi_allocate_real_mode_callback_iret::, for an example of
  18425. usage.
  18426.  
  18427. 
  18428. File: libc.info,  Node: _go32_dpmi_get_free_memory_information,  Next: _go32_dpmi_get_protected_mode_interrupt_vector,  Prev: _go32_dpmi_free_real_mode_callback,  Up: Alphabetical List
  18429.  
  18430. _go32_dpmi_get_free_memory_information
  18431. ======================================
  18432.  
  18433. Syntax
  18434. ------
  18435.  
  18436.      #include <dpmi.h
  18437.      
  18438.      int _go32_dpmi_get_free_memory_information(_go32_dpmi_meminfo *info);
  18439.  
  18440. Description
  18441. -----------
  18442.  
  18443. This function fills in the following structure:
  18444.  
  18445.      typedef struct {
  18446.        u_long available_memory;
  18447.        u_long available_pages;
  18448.        u_long available_lockable_pages;
  18449.        u_long linear_space;
  18450.        u_long unlocked_pages;
  18451.        u_long available_physical_pages;
  18452.        u_long total_physical_pages;
  18453.        u_long free_linear_space;
  18454.        u_long max_pages_in_paging_file;
  18455.        u_long reserved[3];
  18456.      } _go32_dpmi_meminfo;
  18457.  
  18458. The only field that is guaranteed to have useful data is
  18459. `available_memory'.  Any unavailable field has -1 in it.
  18460.  
  18461. Return Value
  18462. ------------
  18463.  
  18464. Zero on success, nonzero on failure.
  18465.  
  18466. Portability
  18467. -----------
  18468.  
  18469. not ANSI, not POSIX
  18470.  
  18471. Example
  18472. -------
  18473.  
  18474.      int phys_mem_left()
  18475.      {
  18476.        _go32_dpmi_meminfo info;
  18477.        _go32_dpmi_get_free_memory_information(&info);
  18478.        if (info.available_physical_pages != -1)
  18479.          return info.available_physical_pages * 4096;
  18480.        return info.available_memory;
  18481.      }
  18482.  
  18483. 
  18484. File: libc.info,  Node: _go32_dpmi_get_protected_mode_interrupt_vector,  Next: _go32_dpmi_get_real_mode_interrupt_vector,  Prev: _go32_dpmi_get_free_memory_information,  Up: Alphabetical List
  18485.  
  18486. _go32_dpmi_get_protected_mode_interrupt_vector
  18487. ==============================================
  18488.  
  18489. Syntax
  18490. ------
  18491.  
  18492.      #include <dpmi.h>
  18493.      
  18494.      int _go32_dpmi_get_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  18495.  
  18496. Description
  18497. -----------
  18498.  
  18499. *Note DPMI Overview::.
  18500.  
  18501. This function puts the selector and offset of the specified interrupt
  18502. vector into the `pm_selector' and `pm_offset' fields of INFO.  This
  18503. structure can be saved and later passed to
  18504. `_go32_dpmi_get_protected_mode_interrupt_vector' to restore a vector.
  18505.  
  18506. Return Value
  18507. ------------
  18508.  
  18509. Zero on success, nonzero on failure.
  18510.  
  18511. Portability
  18512. -----------
  18513.  
  18514. not ANSI, not POSIX
  18515.  
  18516. Example
  18517. -------
  18518.  
  18519. *Note _go32_dpmi_set_protected_mode_interrupt_vector::, for an example
  18520. of usage.
  18521.  
  18522. 
  18523. File: libc.info,  Node: _go32_dpmi_get_real_mode_interrupt_vector,  Next: _go32_dpmi_lock_code,  Prev: _go32_dpmi_get_protected_mode_interrupt_vector,  Up: Alphabetical List
  18524.  
  18525. _go32_dpmi_get_real_mode_interrupt_vector
  18526. =========================================
  18527.  
  18528. Syntax
  18529. ------
  18530.  
  18531.      #include <dpmi.h>
  18532.      
  18533.      int _go32_dpmi_get_real_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  18534.  
  18535. Description
  18536. -----------
  18537.  
  18538. *Note DPMI Overview::.
  18539.  
  18540. This function gets the real-mode interrupt vector specified into the
  18541. address in the `rm_segment' and `rm_offset' fields in INFO.
  18542.  
  18543. Return Value
  18544. ------------
  18545.  
  18546. Zero on success, nonzero on failure.
  18547.  
  18548. Portability
  18549. -----------
  18550.  
  18551. not ANSI, not POSIX
  18552.  
  18553. Example
  18554. -------
  18555.  
  18556. *Note _go32_dpmi_allocate_real_mode_callback_iret::, for an example of
  18557. usage.
  18558.  
  18559. 
  18560. File: libc.info,  Node: _go32_dpmi_lock_code,  Next: _go32_dpmi_lock_data,  Prev: _go32_dpmi_get_real_mode_interrupt_vector,  Up: Alphabetical List
  18561.  
  18562. _go32_dpmi_lock_code
  18563. ====================
  18564.  
  18565. Syntax
  18566. ------
  18567.  
  18568.      #include <dpmi.h>
  18569.      
  18570.      int _go32_dpmi_lock_code( void *lockaddr, unsigned long locksize);
  18571.  
  18572. Description
  18573. -----------
  18574.  
  18575. Locks the given region of code, starting at LOCKADDR for LOCKSIZE
  18576. bytes.  LOCKADDR is a regular pointer in your program, such as the
  18577. address of a function.
  18578.  
  18579. Return Value
  18580. ------------
  18581.  
  18582. 0 if success, -1 if failure.
  18583.  
  18584. Portability
  18585. -----------
  18586.  
  18587. not ANSI, not POSIX
  18588.  
  18589. Example
  18590. -------
  18591.  
  18592.  
  18593.      void my_handler()
  18594.      {
  18595.      }
  18596.      
  18597.      void lock_my_handler()
  18598.      {
  18599.        _go32_dpmi_lock_code(my_handler, (unsigned long)(lock_my_handler - my_handler));
  18600.      }
  18601.  
  18602. 
  18603. File: libc.info,  Node: _go32_dpmi_lock_data,  Next: _go32_dpmi_remaining_physical_memory,  Prev: _go32_dpmi_lock_code,  Up: Alphabetical List
  18604.  
  18605. _go32_dpmi_lock_data
  18606. ====================
  18607.  
  18608. Syntax
  18609. ------
  18610.  
  18611.      #include <dpmi.h>
  18612.      
  18613.      int _go32_dpmi_lock_data( void *lockaddr, unsigned long locksize);
  18614.  
  18615. Description
  18616. -----------
  18617.  
  18618. Locks the given region of data, starting at LOCKADDR for LOCKSIZE
  18619. bytes.  LOCKADDR is a regular pointer in your program, such as the
  18620. address of a variable.
  18621.  
  18622. Return Value
  18623. ------------
  18624.  
  18625. 0 if success, -1 if failure.
  18626.  
  18627. Portability
  18628. -----------
  18629.  
  18630. not ANSI, not POSIX
  18631.  
  18632. Example
  18633. -------
  18634.  
  18635.  
  18636.      int semaphore=0;
  18637.      
  18638.      void lock_my_handler()
  18639.      {
  18640.        _go32_dpmi_lock_data(&semaphore, 4);
  18641.      }
  18642.  
  18643. 
  18644. File: libc.info,  Node: _go32_dpmi_remaining_physical_memory,  Next: _go32_dpmi_remaining_virtual_memory,  Prev: _go32_dpmi_lock_data,  Up: Alphabetical List
  18645.  
  18646. _go32_dpmi_remaining_physical_memory
  18647. ====================================
  18648.  
  18649. Syntax
  18650. ------
  18651.  
  18652.      #include <dpmi.h>
  18653.      
  18654.      unsigned long _go32_dpmi_remaining_physical_memory(void);
  18655.  
  18656. Description
  18657. -----------
  18658.  
  18659. Returns the amount of physical memory that is still available in the
  18660. system.
  18661.  
  18662. Return Value
  18663. ------------
  18664.  
  18665. The amount in bytes.
  18666.  
  18667. Portability
  18668. -----------
  18669.  
  18670. not ANSI, not POSIX
  18671.  
  18672. 
  18673. File: libc.info,  Node: _go32_dpmi_remaining_virtual_memory,  Next: _go32_dpmi_resize_dos_memory,  Prev: _go32_dpmi_remaining_physical_memory,  Up: Alphabetical List
  18674.  
  18675. _go32_dpmi_remaining_virtual_memory
  18676. ===================================
  18677.  
  18678. Syntax
  18679. ------
  18680.  
  18681.      #include <dpmi.h>
  18682.      
  18683.      unsigned long _go32_dpmi_remaining_virtual_memory(void);
  18684.  
  18685. Description
  18686. -----------
  18687.  
  18688. Returns the amount of virtual memory that is still available in the
  18689. system.
  18690.  
  18691. Return Value
  18692. ------------
  18693.  
  18694. The amount in bytes.
  18695.  
  18696. Portability
  18697. -----------
  18698.  
  18699. not ANSI, not POSIX
  18700.  
  18701. 
  18702. File: libc.info,  Node: _go32_dpmi_resize_dos_memory,  Next: _go32_dpmi_set_protected_mode_interrupt_vector,  Prev: _go32_dpmi_remaining_virtual_memory,  Up: Alphabetical List
  18703.  
  18704. _go32_dpmi_resize_dos_memory
  18705. ============================
  18706.  
  18707. Syntax
  18708. ------
  18709.  
  18710.      #include <dpmi.h>
  18711.      
  18712.      int _go32_dpmi_resize_dos_memory(_go32_dpmi_seginfo *info);
  18713.  
  18714. Description
  18715. -----------
  18716.  
  18717. *Note DPMI Overview::.
  18718.  
  18719. The INFO structure is the same one used to allocate the memory.  Fill
  18720. in a new value for `size' and call this function.  If there is not
  18721. enough memory to satisfy the request, the largest size is filled in to
  18722. the `size' field, the memory is not resized, and this function fails.
  18723.  
  18724. Return Value
  18725. ------------
  18726.  
  18727. Zero on success, nonzero on failure.
  18728.  
  18729. Portability
  18730. -----------
  18731.  
  18732. not ANSI, not POSIX
  18733.  
  18734. Example
  18735. -------
  18736.  
  18737.      _go32_dpmi_seginfo info;
  18738.      info.size = 10;
  18739.      _go32_dpmi_allocate_dos_memory(&info);
  18740.      info.size = 20;
  18741.      _go32_dpmi_resize_dos_memory(&info);
  18742.      _go32_dpmi_free_dos_memory(&info);
  18743.  
  18744. 
  18745. File: libc.info,  Node: _go32_dpmi_set_protected_mode_interrupt_vector,  Next: _go32_dpmi_set_real_mode_interrupt_vector,  Prev: _go32_dpmi_resize_dos_memory,  Up: Alphabetical List
  18746.  
  18747. _go32_dpmi_set_protected_mode_interrupt_vector
  18748. ==============================================
  18749.  
  18750. Syntax
  18751. ------
  18752.  
  18753.      #include <dpmi.h>
  18754.      
  18755.      int _go32_dpmi_set_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  18756.  
  18757. Description
  18758. -----------
  18759.  
  18760. *Note DPMI Overview::.
  18761.  
  18762. This function sets the protected mode interrupt vector specified to
  18763. point to the given function.  The `pm_offset' and `pm_selector' fields
  18764. of INFO must be filled in (*note _go32_my_cs::.).  The following should
  18765. be noted:
  18766.  
  18767.    *  You may not `longjmp' out of an interrupt handler.
  18768.  
  18769.    *  You may not make any function calls that require system calls,
  18770.      such as `printf'.
  18771.  
  18772.    *  This function will not wrap the handler for you.  The
  18773.      `_go32_dpmi_allocate_iret_wrapper' and
  18774.      `_go32_dpmi_chain_protected_mode_interrupt_vector' functions can
  18775.      wrap your function if you want.
  18776.  
  18777.    *  You must set the pm_selector field of INFO.  Use `_go32_my_cs' to
  18778.      get a selector valid for your functions.
  18779.  
  18780. Return Value
  18781. ------------
  18782.  
  18783. Zero on success, nonzero on failure.
  18784.  
  18785. Portability
  18786. -----------
  18787.  
  18788. not ANSI, not POSIX
  18789.  
  18790. Example
  18791. -------
  18792.  
  18793.      volatile int tics = 0;
  18794.      
  18795.      timer_handler()
  18796.      {
  18797.        tics++;
  18798.      }
  18799.      
  18800.      int main()
  18801.      {
  18802.        _go32_dpmi_seginfo old_handler, new_handler;
  18803.      
  18804.        printf("grabbing timer interrupt\n");
  18805.        _go32_dpmi_get_protected_mode_interrupt_vector(8, &old_handler);
  18806.      
  18807.        new_handler.pm_offset = (int)tic_handler;
  18808.        new_handler.pm_selector = _go32_my_cs();
  18809.        _go32_dpmi_chain_protected_mode_interrupt_vector(8, &new_handler);
  18810.      
  18811.        getkey();
  18812.      
  18813.        printf("releasing timer interrupt\n");
  18814.        _go32_dpmi_set_protected_mode_interrupt_vector(8, &old_handler);
  18815.      
  18816.        return 0;
  18817.      }
  18818.  
  18819. 
  18820. File: libc.info,  Node: _go32_dpmi_set_real_mode_interrupt_vector,  Next: _go32_dpmi_simulate_fcall,  Prev: _go32_dpmi_set_protected_mode_interrupt_vector,  Up: Alphabetical List
  18821.  
  18822. _go32_dpmi_set_real_mode_interrupt_vector
  18823. =========================================
  18824.  
  18825. Syntax
  18826. ------
  18827.  
  18828.      #include <dpmi.h>
  18829.      
  18830.      int _go32_dpmi_set_real_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  18831.  
  18832. Description
  18833. -----------
  18834.  
  18835. *Note DPMI Overview::.
  18836.  
  18837. This function sets the real-mode interrupt vector specified to point to
  18838. the address in the `rm_segment' and `rm_offset' fields in INFO.
  18839.  
  18840. Return Value
  18841. ------------
  18842.  
  18843. Zero on success, nonzero on failure.
  18844.  
  18845. Portability
  18846. -----------
  18847.  
  18848. not ANSI, not POSIX
  18849.  
  18850. Example
  18851. -------
  18852.  
  18853. *Note _go32_dpmi_allocate_real_mode_callback_iret::, for an example of
  18854. usage.
  18855.  
  18856. 
  18857. File: libc.info,  Node: _go32_dpmi_simulate_fcall,  Next: _go32_dpmi_simulate_fcall_iret,  Prev: _go32_dpmi_set_real_mode_interrupt_vector,  Up: Alphabetical List
  18858.  
  18859. _go32_dpmi_simulate_fcall
  18860. =========================
  18861.  
  18862. Syntax
  18863. ------
  18864.  
  18865.      #include <dpmi.h>
  18866.      
  18867.      int _go32_dpmi_simulate_fcall(_go32_dpmi_registers *regs);
  18868.  
  18869. Description
  18870. -----------
  18871.  
  18872. *Note DPMI Overview::.
  18873.  
  18874. This function simulates a real-mode far call to a function that returns
  18875. with a far return.  The registers are set up from REGS, including `CS'
  18876. and `IP', which indicate the address of the call.  Any registers the
  18877. function modifies are reflected in REGS on return.
  18878.  
  18879. If `SS' and `SP' are both zero, a small temporary stack is used when in
  18880. real mode.  If not, they are used *as is*.  It's a good idea to use
  18881. `memset' to initialize the register structure before using it.
  18882.  
  18883. Return Value
  18884. ------------
  18885.  
  18886. Zero on success, nonzero on failure.
  18887.  
  18888. Portability
  18889. -----------
  18890.  
  18891. not ANSI, not POSIX
  18892.  
  18893. Example
  18894. -------
  18895.  
  18896.      _go32_dpmi_registers r;
  18897.      r.x.ax = 47;
  18898.      r.x.cs = some_segment;
  18899.      r.x.ip = some_offset;
  18900.      r.x.ss = r.x.sp = 0;
  18901.      _go32_dpmi_simulate_fcall(&r);
  18902.      printf("returns %d\n", r.x.ax);
  18903.  
  18904. 
  18905. File: libc.info,  Node: _go32_dpmi_simulate_fcall_iret,  Next: _go32_dpmi_simulate_int,  Prev: _go32_dpmi_simulate_fcall,  Up: Alphabetical List
  18906.  
  18907. _go32_dpmi_simulate_fcall_iret
  18908. ==============================
  18909.  
  18910. Syntax
  18911. ------
  18912.  
  18913.      #include <dpmi.h>
  18914.      
  18915.      int _go32_dpmi_simulate_fcall_iret(_go32_dpmi_registers *regs);
  18916.  
  18917. Description
  18918. -----------
  18919.  
  18920. *Note DPMI Overview::.
  18921.  
  18922. This function simulates a real-mode far call to a function that returns
  18923. with an `iret' instruction.  The registers are set up from REGS,
  18924. including `CS' and `IP', which indicate the address of the call.  Any
  18925. registers the function modifies are reflected in REGS on return.
  18926.  
  18927. If `SS' and `SP' are both zero, a small temporary stack is used when in
  18928. real mode.  If not, they are used *as is*.  It's a good idea to use
  18929. `memset' to initialize the register structure before using it.
  18930.  
  18931. Return Value
  18932. ------------
  18933.  
  18934. Zero on success, nonzero on failure.
  18935.  
  18936. Portability
  18937. -----------
  18938.  
  18939. not ANSI, not POSIX
  18940.  
  18941. Example
  18942. -------
  18943.  
  18944.      _go32_dpmi_registers r;
  18945.      r.x.ax = 47;
  18946.      r.x.cs = some_segment;
  18947.      r.x.ip = some_offset;
  18948.      r.x.ss = r.x.sp = 0;
  18949.      _go32_dpmi_simulate_fcall_iret(&r);
  18950.      printf("returns %d\n", r.x.ax);
  18951.  
  18952. 
  18953. File: libc.info,  Node: _go32_dpmi_simulate_int,  Next: _go32_info_block,  Prev: _go32_dpmi_simulate_fcall_iret,  Up: Alphabetical List
  18954.  
  18955. _go32_dpmi_simulate_int
  18956. =======================
  18957.  
  18958. Syntax
  18959. ------
  18960.  
  18961.      #include <dpmi.h>
  18962.      
  18963.      int _go32_dpmi_simulate_int(int vector, _go32_dpmi_registers *regs);
  18964.  
  18965. Description
  18966. -----------
  18967.  
  18968. *Note DPMI Overview::.
  18969.  
  18970. This function simulates a real-mode interrup.  The registers are set up
  18971. from REGS, including `CS' and `IP', which indicate the address of the
  18972. call.  Any registers the function modifies are reflected in REGS on
  18973. return.
  18974.  
  18975. If `SS' and `SP' are both zero, a small temporary stack is used when in
  18976. real mode.  If not, they are used *as is*.  It's a good idea to use
  18977. `memset' to initialize the register structure before using it.
  18978.  
  18979. Return Value
  18980. ------------
  18981.  
  18982. Zero on success, nonzero on failure.
  18983.  
  18984. Portability
  18985. -----------
  18986.  
  18987. not ANSI, not POSIX
  18988.  
  18989. Example
  18990. -------
  18991.  
  18992.      _go32_dpmi_registers r;
  18993.      r.h.ah = 0x08;
  18994.      r.h.dl = 0x80; /* drive C: */
  18995.      r.x.ss = r.x.sp = 0;
  18996.      _go32_dpmi_simulate_int(0x13, &r);
  18997.      printf("disk is %d cyl, %d head, %d sect\n",
  18998.             r.h.ch | ((r.x.cl<<2)&0x300),
  18999.             r.h.dh, r.h.cl & 0x3f));
  19000.  
  19001. 
  19002. File: libc.info,  Node: _go32_info_block,  Next: _go32_interrupt_stack_size,  Prev: _go32_dpmi_simulate_int,  Up: Alphabetical List
  19003.  
  19004. _go32_info_block
  19005. ================
  19006.  
  19007. Syntax
  19008. ------
  19009.  
  19010.      #include <go32.h>
  19011.      
  19012.      extern __Go32_Info_Block _go32_info_block;
  19013.  
  19014. Description
  19015. -----------
  19016.  
  19017. The go32 information block is a mechanism for `go32' to pass
  19018. information to the application.  Some of this information is generally
  19019. useful, such as the pid or the transfer buffer, while some is used
  19020. internally to `libc.a' only.
  19021.  
  19022. The structure has this format:
  19023.  
  19024.      typedef struct {
  19025.        unsigned long  size_of_this_structure_in_bytes;
  19026.        unsigned long  linear_address_of_primary_screen;
  19027.        unsigned long  linear_address_of_secondary_screen;
  19028.        unsigned long  linear_address_of_transfer_buffer;
  19029.        unsigned long  size_of_transfer_buffer;
  19030.        unsigned long  pid;
  19031.        unsigned char  master_interrupt_controller_base;
  19032.        unsigned char  slave_interrupt_controller_base;
  19033.        unsigned short selector_for_linear_memory;
  19034.        unsigned long  linear_address_of_stub_info_structure;
  19035.        unsigned long  linear_address_of_original_psp;
  19036.        unsigned short run_mode;
  19037.        unsigned short run_mode_info;
  19038.      } Go32_Info_Block;
  19039.  
  19040. The linear address fields provide values that are suitable for
  19041. `dosmemget', `dosmemput', and `movedata'.  The
  19042. selector_for_linear_memory is suitable for `<sys/farptr.h>' selector
  19043. parameters.
  19044.  
  19045. Due to the length of these fields, and their popularity, the following
  19046. macros are available:
  19047.  
  19048. `_dos_ds'
  19049.      This expands to _go32_info_block.selector_for_linear_memory
  19050.  
  19051. `__tb'
  19052.      This expands to _go32_info_block.linear_address_of_transfer_buffer
  19053.  
  19054. The `run_mode' field indicates the mode that the program is running in.
  19055. The following modes are defined:
  19056.  
  19057. `_GO32_RUN_MODE_UNDEF'
  19058.      This indicates that the extender did not (or could not) determine
  19059.      or provide the mode information.  The most probable reason is that
  19060.      it's an older extender that does not support this field.  The
  19061.      program should not assume anything about the run mode if it is
  19062.      this value.
  19063.  
  19064. `_GO32_RUN_MODE_RAW'
  19065.      This indicates that no CPU manager is being used, and no XMS
  19066.      manager is present.  The CPU is being managed directly from the
  19067.      extender, and memory was allocated from the extended memory pool.
  19068.  
  19069. `_GO32_RUN_MODE_XMS'
  19070.      This indicates that the extender is managing the CPU, but an XMS
  19071.      driver is managing the memory pool.
  19072.  
  19073. `_GO32_RUN_MODE_VCPI'
  19074.      This indicates that a VCPI server (like `emm386' or `qemm') is
  19075.      managing both the CPU and the memory.
  19076.  
  19077. `_GO32_RUN_MODE_DPMI'
  19078.      This indicates that a DPMI server (like `qdpmi' or Windows) is
  19079.      managing both the CPU and memory.  Programs may rely on this value
  19080.      to determine if it is safe to use DPMI 0.9 functions.
  19081.  
  19082.      If this value is set, the `run_mode_info' field has the DPMI
  19083.      specification version, in hex, shifted eight bits.  For example,
  19084.      DPMI 0.9 has 0x005A in the `run_mode_info' field.
  19085.  
  19086. Note that the program should not assume that the value will be one of
  19087. the listed values.  If the program is running with an extender that
  19088. provides some other mode (say, a newly released extender) then the
  19089. program should be able to handle that case gracefully.
  19090.  
  19091. Portability
  19092. -----------
  19093.  
  19094. not ANSI, not POSIX
  19095.  
  19096. Example
  19097. -------
  19098.  
  19099.      dosmemget(_go32_info_block.linear_address_of_primary_screen, 80*25*2, buf);
  19100.  
  19101. 
  19102. File: libc.info,  Node: _go32_interrupt_stack_size,  Next: _go32_my_cs,  Prev: _go32_info_block,  Up: Alphabetical List
  19103.  
  19104. _go32_interrupt_stack_size
  19105. ==========================
  19106.  
  19107. Syntax
  19108. ------
  19109.  
  19110.      #include <dpmi.h>
  19111.      
  19112.      extern unsigned long _go32_interrupt_stack_size;
  19113.  
  19114. Description
  19115. -----------
  19116.  
  19117. The default size of the interrupt handler's stack.  Defaults to 32k.
  19118.  
  19119. Portability
  19120. -----------
  19121.  
  19122. not ANSI, not POSIX
  19123.  
  19124. 
  19125. File: libc.info,  Node: _go32_my_cs,  Next: _go32_my_ds,  Prev: _go32_interrupt_stack_size,  Up: Alphabetical List
  19126.  
  19127. _go32_my_cs
  19128. ===========
  19129.  
  19130. Syntax
  19131. ------
  19132.  
  19133.      #include <go32.h>
  19134.      
  19135.      u_short _go32_my_cs();
  19136.  
  19137. Description
  19138. -----------
  19139.  
  19140. Returns the current `CS'.  This is useful for setting up interrupt
  19141. vectors and such.
  19142.  
  19143. Return Value
  19144. ------------
  19145.  
  19146. `CS'
  19147.  
  19148. Portability
  19149. -----------
  19150.  
  19151. not ANSI, not POSIX
  19152.  
  19153. 
  19154. File: libc.info,  Node: _go32_my_ds,  Next: _go32_my_ss,  Prev: _go32_my_cs,  Up: Alphabetical List
  19155.  
  19156. _go32_my_ds
  19157. ===========
  19158.  
  19159. Syntax
  19160. ------
  19161.  
  19162.      #include <go32.h>
  19163.      
  19164.      u_short _go32_my_ds();
  19165.  
  19166. Description
  19167. -----------
  19168.  
  19169. Returns the current `DS'.  This is useful for moving memory and such.
  19170.  
  19171. Return Value
  19172. ------------
  19173.  
  19174. `DS'
  19175.  
  19176. Portability
  19177. -----------
  19178.  
  19179. not ANSI, not POSIX
  19180.  
  19181. 
  19182. File: libc.info,  Node: _go32_my_ss,  Next: _go32_rmcb_stack_size,  Prev: _go32_my_ds,  Up: Alphabetical List
  19183.  
  19184. _go32_my_ss
  19185. ===========
  19186.  
  19187. Syntax
  19188. ------
  19189.  
  19190.      #include <go32.h>
  19191.      
  19192.      u_short _go32_my_ss();
  19193.  
  19194. Description
  19195. -----------
  19196.  
  19197. Returns the current `SS'.  This is useful for moving memory and such.
  19198.  
  19199. Return Value
  19200. ------------
  19201.  
  19202. `SS'
  19203.  
  19204. Portability
  19205. -----------
  19206.  
  19207. not ANSI, not POSIX
  19208.  
  19209. 
  19210. File: libc.info,  Node: _go32_rmcb_stack_size,  Next: _go32_want_ctrl_break,  Prev: _go32_my_ss,  Up: Alphabetical List
  19211.  
  19212. _go32_rmcb_stack_size
  19213. =====================
  19214.  
  19215. Syntax
  19216. ------
  19217.  
  19218.      #include <dpmi.h>
  19219.      
  19220.      extern unsigned long _go32_rmcb_stack_size;
  19221.  
  19222. Description
  19223. -----------
  19224.  
  19225. The default size of the real mode callback handler's stack.  Defaults
  19226. to 32k.
  19227.  
  19228. Portability
  19229. -----------
  19230.  
  19231. not ANSI, not POSIX
  19232.  
  19233. 
  19234. File: libc.info,  Node: _go32_want_ctrl_break,  Next: _go32_was_ctrl_break_hit,  Prev: _go32_rmcb_stack_size,  Up: Alphabetical List
  19235.  
  19236. _go32_want_ctrl_break
  19237. =====================
  19238.  
  19239. Syntax
  19240. ------
  19241.  
  19242.      #include <go32.h>
  19243.      
  19244.      void   _go32_want_ctrl_break(int yes);
  19245.  
  19246. Description
  19247. -----------
  19248.  
  19249. This function tells go32 whether or not it wants `Ctrl-Break' to be an
  19250. exception or passed to the application.  If you pass a nonzero value
  19251. for YES, pressing `Ctrl-Break' will set a flag that can be detected
  19252. with `_go32_was_ctrl_break_hit' (*note _go32_was_ctrl_break_hit::.).
  19253. If you pass zero for YES, when you press `Ctrl-Break' the program will
  19254. be terminated.
  19255.  
  19256. Note that if you call `_go32_was_ctrl_break_hit', this function
  19257. automatically gets called to ask for `Ctrl-Break' events.
  19258.  
  19259. Return Value
  19260. ------------
  19261.  
  19262. None.
  19263.  
  19264. Portability
  19265. -----------
  19266.  
  19267. not ANSI, not POSIX
  19268.  
  19269. Example
  19270. -------
  19271.  
  19272.      _g32_want_ctrl_break(1);
  19273.      do_something_long();
  19274.      _g32_want_ctrl_break(0);
  19275.  
  19276. 
  19277. File: libc.info,  Node: _go32_was_ctrl_break_hit,  Next: gotoxy,  Prev: _go32_want_ctrl_break,  Up: Alphabetical List
  19278.  
  19279. _go32_was_ctrl_break_hit
  19280. ========================
  19281.  
  19282. Syntax
  19283. ------
  19284.  
  19285.      #include <go32.h>
  19286.      
  19287.      unsigned _go32_was_ctrl_break_hit(void);
  19288.  
  19289. Description
  19290. -----------
  19291.  
  19292. This function returns the number of times that `Ctrl-Break' was hit
  19293. since the last call to this function or `_go32_want_ctrl_break' (*note
  19294. _go32_want_ctrl_break::.).
  19295.  
  19296. Return Value
  19297. ------------
  19298.  
  19299. Zero if `Ctrl-Break' hasn't been hit, nonzero to indicate how many
  19300. times if it has been hit.
  19301.  
  19302. Note that `_go32_want_ctrl_break' is automatically called to request
  19303. these events, so you don't have to set up for this call.
  19304.  
  19305. Portability
  19306. -----------
  19307.  
  19308. not ANSI, not POSIX
  19309.  
  19310. Example
  19311. -------
  19312.  
  19313.      while (!_go32_was_ctrl_break_hit())
  19314.        do_something();
  19315.  
  19316. 
  19317. File: libc.info,  Node: gotoxy,  Next: gppconio_init,  Prev: _go32_was_ctrl_break_hit,  Up: Alphabetical List
  19318.  
  19319. gotoxy
  19320. ======
  19321.  
  19322. Syntax
  19323. ------
  19324.  
  19325.      #include <conio.h>
  19326.      
  19327.      void gotoxy(int x, int y);
  19328.  
  19329. Description
  19330. -----------
  19331.  
  19332. Move the cursor to row y, column x.  The upper left corner of the
  19333. current window is (1,1).
  19334.  
  19335. Portability
  19336. -----------
  19337.  
  19338. not ANSI, not POSIX
  19339.  
  19340. 
  19341. File: libc.info,  Node: gppconio_init,  Next: hasmntopt,  Prev: gotoxy,  Up: Alphabetical List
  19342.  
  19343. gppconio_init
  19344. =============
  19345.  
  19346. Syntax
  19347. ------
  19348.  
  19349.      #include <conio.h>
  19350.      
  19351.      void gppconio_init(void);
  19352.  
  19353. Description
  19354. -----------
  19355.  
  19356. Initialize the screen.  This is called automatically at program start-up
  19357. if you use any of the `conio' functions, but there may be times when
  19358. you need to call it again, typically after calling some video BIOS
  19359. function which affects screen parameters.
  19360.  
  19361. Portability
  19362. -----------
  19363.  
  19364. not ANSI, not POSIX
  19365.  
  19366. 
  19367. File: libc.info,  Node: hasmntopt,  Next: highvideo,  Prev: gppconio_init,  Up: Alphabetical List
  19368.  
  19369. hasmntopt
  19370. =========
  19371.  
  19372. Syntax
  19373. ------
  19374.  
  19375.      #include <mntent.h>
  19376.      
  19377.      char *hasmntopt(const struct mntent *mnt, const char *opt);
  19378.  
  19379. Description
  19380. -----------
  19381.  
  19382. This function scans the `mnt_opts' field of the `mntent' structure
  19383. pointed to by MNT for a substring that matches OPT.  *Note getmntent::.
  19384.  
  19385. Return Value
  19386. ------------
  19387.  
  19388. This function returns the address of the substring if a match is found,
  19389. or `NULL' otherwise.
  19390.  
  19391. Portability
  19392. -----------
  19393.  
  19394. not ANSI, not POSIX
  19395.  
  19396. 
  19397. File: libc.info,  Node: highvideo,  Next: htonl,  Prev: hasmntopt,  Up: Alphabetical List
  19398.  
  19399. highvideo
  19400. =========
  19401.  
  19402. Syntax
  19403. ------
  19404.  
  19405.      #include <conio.h>
  19406.      
  19407.      void highvideo(void);
  19408.  
  19409. Description
  19410. -----------
  19411.  
  19412. Causes any new characters put on the screen to be bright.
  19413.  
  19414. Portability
  19415. -----------
  19416.  
  19417. not ANSI, not POSIX
  19418.  
  19419. 
  19420. File: libc.info,  Node: htonl,  Next: htons,  Prev: highvideo,  Up: Alphabetical List
  19421.  
  19422. htonl
  19423. =====
  19424.  
  19425. Syntax
  19426. ------
  19427.  
  19428.      #include <netinet/in.h>
  19429.      
  19430.      unsigned long htonl(unsigned long val);
  19431.  
  19432. Description
  19433. -----------
  19434.  
  19435. This function converts from host formatted longs to network formatted
  19436. longs.  For the i386 and higher processors, this means that the bytes
  19437. are swapped from 1234 order to 4321 order.
  19438.  
  19439. Return Value
  19440. ------------
  19441.  
  19442. The network-order value.
  19443.  
  19444. Portability
  19445. -----------
  19446.  
  19447. not ANSI, not POSIX
  19448.  
  19449. Example
  19450. -------
  19451.  
  19452.      packet.ipaddr = htonl(ip);
  19453.  
  19454. 
  19455. File: libc.info,  Node: htons,  Next: hypot,  Prev: htonl,  Up: Alphabetical List
  19456.  
  19457. htons
  19458. =====
  19459.  
  19460. Syntax
  19461. ------
  19462.  
  19463.      #include <netinet/in.h>
  19464.      
  19465.      unsigned short htons(unsigned short val);
  19466.  
  19467. Description
  19468. -----------
  19469.  
  19470. This function converts from host formatted shorts to network formatted
  19471. shorts.  For the i386 and higher processors, this means that the bytes
  19472. are swapped from 12 order to 21 order.
  19473.  
  19474. Return Value
  19475. ------------
  19476.  
  19477. The network-order value.
  19478.  
  19479. Portability
  19480. -----------
  19481.  
  19482. not ANSI, not POSIX
  19483.  
  19484. Example
  19485. -------
  19486.  
  19487.      tcp.port = htons(port);
  19488.  
  19489. 
  19490. File: libc.info,  Node: hypot,  Next: inb,  Prev: htons,  Up: Alphabetical List
  19491.  
  19492. hypot
  19493. =====
  19494.  
  19495. Syntax
  19496. ------
  19497.  
  19498.      #include <math.h>
  19499.      
  19500.      double hypot(double x, double y);
  19501.  
  19502. Description
  19503. -----------
  19504.  
  19505. This function computes `sqrt(X*X + Y*Y)', the length of a hypotenuse of
  19506. a right triangle whose shorter sides are X and Y.  In other words, it
  19507. computes the Euclidean distance between the points `(0,0)' and `(X,Y)'.
  19508. Since the computation is done in extended precision, there is no
  19509. danger of overflow or underflow when squaring the arguments, whereas
  19510. direct computation of `sqrt(X*X + Y*Y)' could cause overflow or
  19511. underflow for extreme (very large or very small) values of X and Y.
  19512.  
  19513. Return Value
  19514. ------------
  19515.  
  19516. The value of `sqrt(X*X + Y*Y)'.  If both arguments are finite, but the
  19517. result is so large that it would overflow a `double', the return value
  19518. is `Inf', and `errno' is set to `ERANGE'.  If one of the arguments is
  19519. `Inf', the return value is `Inf' and the value of `errno' is left
  19520. unchanged.  If one of the arguments is `NaN', the return value is `NaN'
  19521. and `errno' is set to `EDOM'.
  19522.  
  19523. Portability
  19524. -----------
  19525.  
  19526. not ANSI, not POSIX
  19527.  
  19528. 
  19529. File: libc.info,  Node: inb,  Next: index,  Prev: hypot,  Up: Alphabetical List
  19530.  
  19531. inb
  19532. ===
  19533.  
  19534. Syntax
  19535. ------
  19536.  
  19537.      #include <pc.h>
  19538.      
  19539.      unsigned char inb(unsigned short _port);
  19540.  
  19541. Description
  19542. -----------
  19543.  
  19544. Calls *Note inportb::. Provided only for compatibility.
  19545.  
  19546. Portability
  19547. -----------
  19548.  
  19549. not ANSI, not POSIX
  19550.  
  19551. 
  19552. File: libc.info,  Node: index,  Next: initstate,  Prev: inb,  Up: Alphabetical List
  19553.  
  19554. index
  19555. =====
  19556.  
  19557. Syntax
  19558. ------
  19559.  
  19560.      #include <strings.h>
  19561.      
  19562.      char *index(const char *string, int ch);
  19563.  
  19564. Description
  19565. -----------
  19566.  
  19567. Returns a pointer to the first occurrence of CH in STRING.  Note that
  19568. the `NULL' character counts, so if you pass zero as CH you'll get a
  19569. pointer to the end of the string back.
  19570.  
  19571. Return Value
  19572. ------------
  19573.  
  19574. A pointer to the character, or `NULL' if it wasn't found.
  19575.  
  19576. Portability
  19577. -----------
  19578.  
  19579. not ANSI, not POSIX
  19580.  
  19581. Example
  19582. -------
  19583.  
  19584.      if (index(path, '*'))
  19585.        do_wildcards(path);
  19586.  
  19587. 
  19588. File: libc.info,  Node: initstate,  Next: inp,  Prev: index,  Up: Alphabetical List
  19589.  
  19590. initstate
  19591. =========
  19592.  
  19593. Syntax
  19594. ------
  19595.  
  19596.      #include <stdlib.h>
  19597.      
  19598.      char *initstate(unsigned seed, char *arg_state, int n);
  19599.  
  19600. Description
  19601. -----------
  19602.  
  19603. Initializes the random number generator (*note random::.) with pointer
  19604. ARG_STATE to array of N bytes, then calls `srandom' with SEED.
  19605.  
  19606. Return Value
  19607. ------------
  19608.  
  19609. Pointer to old state information.
  19610.  
  19611. Portability
  19612. -----------
  19613.  
  19614. not ANSI, not POSIX
  19615.  
  19616. 
  19617. File: libc.info,  Node: inp,  Next: inportb,  Prev: initstate,  Up: Alphabetical List
  19618.  
  19619. inp
  19620. ===
  19621.  
  19622. Syntax
  19623. ------
  19624.  
  19625.      #include <pc.h>
  19626.      
  19627.      unsigned char inp(unsigned short _port);
  19628.  
  19629. Description
  19630. -----------
  19631.  
  19632. Calls *Note inportb::.  Provided only for compatibility.
  19633.  
  19634. Portability
  19635. -----------
  19636.  
  19637. not ANSI, not POSIX
  19638.  
  19639. 
  19640. File: libc.info,  Node: inportb,  Next: inportl,  Prev: inp,  Up: Alphabetical List
  19641.  
  19642. inportb
  19643. =======
  19644.  
  19645. Syntax
  19646. ------
  19647.  
  19648.      #include <pc.h>
  19649.      
  19650.      unsigned char inportb(unsigned short _port);
  19651.  
  19652. Description
  19653. -----------
  19654.  
  19655. Read a single 8-bit I/O port.
  19656.  
  19657. This function is provided as an inline assembler macro, and will be
  19658. optimized down to a single opcode when you optimize your program.
  19659.  
  19660. Return Value
  19661. ------------
  19662.  
  19663. The value returned through the port.
  19664.  
  19665. Portability
  19666. -----------
  19667.  
  19668. not ANSI, not POSIX
  19669.  
  19670. 
  19671. File: libc.info,  Node: inportl,  Next: inportsb,  Prev: inportb,  Up: Alphabetical List
  19672.  
  19673. inportl
  19674. =======
  19675.  
  19676. Syntax
  19677. ------
  19678.  
  19679.      #include <pc.h>
  19680.      
  19681.      unsigned long inportl(unsigned short _port);
  19682.  
  19683. Description
  19684. -----------
  19685.  
  19686. This function reads a single 32-bit I/O port.
  19687.  
  19688. This function is provided as an inline assembler macro, and will be
  19689. optimized down to a single opcode when you optimize your program.
  19690.  
  19691. Return Value
  19692. ------------
  19693.  
  19694. The value returned from the port.
  19695.  
  19696. Portability
  19697. -----------
  19698.  
  19699. not ANSI, not POSIX
  19700.  
  19701. 
  19702. File: libc.info,  Node: inportsb,  Next: inportsl,  Prev: inportl,  Up: Alphabetical List
  19703.  
  19704. inportsb
  19705. ========
  19706.  
  19707. Syntax
  19708. ------
  19709.  
  19710.      #include <pc.h>
  19711.      
  19712.      void inportsb(unsigned short _port, unsigned char *_buf, unsigned _len);
  19713.  
  19714. Description
  19715. -----------
  19716.  
  19717. Reads the 8-bit _PORT _LEN times, and stores the bytes in BUF.
  19718.  
  19719. Portability
  19720. -----------
  19721.  
  19722. not ANSI, not POSIX
  19723.  
  19724. 
  19725. File: libc.info,  Node: inportsl,  Next: inportsw,  Prev: inportsb,  Up: Alphabetical List
  19726.  
  19727. inportsl
  19728. ========
  19729.  
  19730. Syntax
  19731. ------
  19732.  
  19733.      #include <pc.h>
  19734.      
  19735.      void inportsl(unsigned short _port, unsigned long *_buf, unsigned _len);
  19736.  
  19737. Description
  19738. -----------
  19739.  
  19740. Reads the 32-bit _PORT _LEN times, and stores the bytes in BUF.
  19741.  
  19742. Portability
  19743. -----------
  19744.  
  19745. not ANSI, not POSIX
  19746.  
  19747. 
  19748. File: libc.info,  Node: inportsw,  Next: inportw,  Prev: inportsl,  Up: Alphabetical List
  19749.  
  19750. inportsw
  19751. ========
  19752.  
  19753. Syntax
  19754. ------
  19755.  
  19756.      #include <pc.h>
  19757.      
  19758.      void inportsw(unsigned short _port, unsigned short *_buf, unsigned _len);
  19759.  
  19760. Description
  19761. -----------
  19762.  
  19763. Reads the 16-bit _PORT _LEN times, and stores the bytes in BUF.
  19764.  
  19765. Portability
  19766. -----------
  19767.  
  19768. not ANSI, not POSIX
  19769.  
  19770. 
  19771. File: libc.info,  Node: inportw,  Next: inpw,  Prev: inportsw,  Up: Alphabetical List
  19772.  
  19773. inportw
  19774. =======
  19775.  
  19776. Syntax
  19777. ------
  19778.  
  19779.      #include <pc.h>
  19780.      
  19781.      unsigned short inportw(unsigned short _port);
  19782.  
  19783. Description
  19784. -----------
  19785.  
  19786. Read a single 16-bit I/O port.
  19787.  
  19788. This function is provided as an inline assembler macro, and will be
  19789. optimized down to a single opcode when you optimize your program.
  19790.  
  19791. Return Value
  19792. ------------
  19793.  
  19794. The value returned through the port.
  19795.  
  19796. Portability
  19797. -----------
  19798.  
  19799. not ANSI, not POSIX
  19800.  
  19801. 
  19802. File: libc.info,  Node: inpw,  Next: insline,  Prev: inportw,  Up: Alphabetical List
  19803.  
  19804. inpw
  19805. ====
  19806.  
  19807. Syntax
  19808. ------
  19809.  
  19810.      #include <pc.h>
  19811.      
  19812.      unsigned short inpw(unsigned short _port);
  19813.  
  19814. Description
  19815. -----------
  19816.  
  19817. Calls *Note inportw::.  Provided only for compatibility.
  19818.  
  19819. Portability
  19820. -----------
  19821.  
  19822. not ANSI, not POSIX
  19823.  
  19824. 
  19825. File: libc.info,  Node: insline,  Next: insque,  Prev: inpw,  Up: Alphabetical List
  19826.  
  19827. insline
  19828. =======
  19829.  
  19830. Syntax
  19831. ------
  19832.  
  19833.      #include <conio.h>
  19834.      
  19835.      void insline(void);
  19836.  
  19837. Description
  19838. -----------
  19839.  
  19840. A blank line is inserted at the current cursor position.  The previous
  19841. line and lines below it scroll down.
  19842.  
  19843. Portability
  19844. -----------
  19845.  
  19846. not ANSI, not POSIX
  19847.  
  19848. 
  19849. File: libc.info,  Node: insque,  Next: int386,  Prev: insline,  Up: Alphabetical List
  19850.  
  19851. insque
  19852. ======
  19853.  
  19854. Syntax
  19855. ------
  19856.  
  19857.      #include <search.h>
  19858.      
  19859.      void insque(struct qelem *elem, struct qelem *pred);
  19860.  
  19861. Description
  19862. -----------
  19863.  
  19864. This function manipulates queues built from doubly linked lists.  Each
  19865. element in the queue must be in the form of `struct qelem' which is
  19866. defined thus:
  19867.  
  19868.      struct qelem {
  19869.        struct qelem *q_forw;
  19870.        struct qelem *q_back;
  19871.        char q_data[0];
  19872.      }
  19873.  
  19874. This function inserts ELEM in a queue immediately after PRED.
  19875.  
  19876. Return Value
  19877. ------------
  19878.  
  19879. None.
  19880.  
  19881. Portability
  19882. -----------
  19883.  
  19884. not ANSI, not POSIX
  19885.  
  19886. 
  19887. File: libc.info,  Node: int386,  Next: int386x,  Prev: insque,  Up: Alphabetical List
  19888.  
  19889. int386
  19890. ======
  19891.  
  19892. Syntax
  19893. ------
  19894.  
  19895.      #include <dos.h>
  19896.      
  19897.      int int386(int ivec, union REGS *in, union REGS *out);
  19898.  
  19899. Description
  19900. -----------
  19901.  
  19902. This function is equal to `int86' function.  See *Note int86::, for
  19903. further description.
  19904.  
  19905. Return Value
  19906. ------------
  19907.  
  19908. The returned value of `EAX'.
  19909.  
  19910. Portability
  19911. -----------
  19912.  
  19913. not ANSI, not POSIX
  19914.  
  19915. 
  19916. File: libc.info,  Node: int386x,  Next: int86,  Prev: int386,  Up: Alphabetical List
  19917.  
  19918. int386x
  19919. =======
  19920.  
  19921. Syntax
  19922. ------
  19923.  
  19924.      #include <dos.h>
  19925.      
  19926.      int int386x(int ivec, union REGS *in, union REGS *out, struct SREGS *seg);
  19927.  
  19928. Description
  19929. -----------
  19930.  
  19931. This function is equal to `int86x'.  See *Note int86::, for further
  19932. description.
  19933.  
  19934. Return Value
  19935. ------------
  19936.  
  19937. The value of `EAX' is returned.
  19938.  
  19939. Portability
  19940. -----------
  19941.  
  19942. not ANSI, not POSIX
  19943.  
  19944. 
  19945. File: libc.info,  Node: int86,  Next: int86x,  Prev: int386x,  Up: Alphabetical List
  19946.  
  19947. int86
  19948. =====
  19949.  
  19950. Syntax
  19951. ------
  19952.  
  19953.      #include <dos.h>
  19954.      
  19955.      int int86(int ivec, union REGS *in, union REGS *out);
  19956.  
  19957. Description
  19958. -----------
  19959.  
  19960. The `union REGS' is defined by `<dos.h>' as follows:
  19961.  
  19962.      struct DWORDREGS {
  19963.        unsigned long edi;
  19964.        unsigned long esi;
  19965.        unsigned long ebp;
  19966.        unsigned long cflag;
  19967.        unsigned long ebx;
  19968.        unsigned long edx;
  19969.        unsigned long ecx;
  19970.        unsigned long eax;
  19971.        unsigned short eflags;
  19972.      };
  19973.      
  19974.      struct DWORDREGS_W {
  19975.        unsigned long di;
  19976.        unsigned long si;
  19977.        unsigned long bp;
  19978.        unsigned long cflag;
  19979.        unsigned long bx;
  19980.        unsigned long dx;
  19981.        unsigned long cx;
  19982.        unsigned long ax;
  19983.        unsigned short flags;
  19984.      };
  19985.      
  19986.      struct WORDREGS {
  19987.        unsigned short di, _upper_di;
  19988.        unsigned short si, _upper_si;
  19989.        unsigned short bp, _upper_bp;
  19990.        unsigned short cflag, _upper_cflag;
  19991.        unsigned short bx, _upper_bx;
  19992.        unsigned short dx, _upper_dx;
  19993.        unsigned short cx, _upper_cx;
  19994.        unsigned short ax, _upper_ax;
  19995.        unsigned short flags;
  19996.      };
  19997.      
  19998.      struct BYTEREGS {
  19999.        unsigned short di, _upper_di;
  20000.        unsigned short si, _upper_si;
  20001.        unsigned short bp, _upper_bp;
  20002.        unsigned long cflag;
  20003.        unsigned char bl;
  20004.        unsigned char bh;
  20005.        unsigned short _upper_bx;
  20006.        unsigned char dl;
  20007.        unsigned char dh;
  20008.        unsigned short _upper_dx;
  20009.        unsigned char cl;
  20010.        unsigned char ch;
  20011.        unsigned short _upper_cx;
  20012.        unsigned char al;
  20013.        unsigned char ah;
  20014.        unsigned short _upper_ax;
  20015.        unsigned short flags;
  20016.      };
  20017.      
  20018.      union REGS {
  20019.        struct DWORDREGS d;
  20020.      #ifdef _NAIVE_DOS_REGS
  20021.        struct WORDREGS x;
  20022.      #else
  20023.      #ifdef _BORLAND_DOS_REGS
  20024.        struct DWORDREGS x;
  20025.      #else
  20026.        struct DWORDREGS_W x;
  20027.      #endif
  20028.      #endif
  20029.        struct WORDREGS w;
  20030.        struct BYTEREGS h;
  20031.      };
  20032.  
  20033. Note: The `.x.' branch is a problem generator.  Most programs expect
  20034. the `.x.' branch to have e.g. "`.x.ax'" members, and that they are
  20035. 16-bit.  If you know you want 32-bit values, use the `.d.eax' members.
  20036. If you know you want 16-bit values, use the `.w.ax' members.  The `.x.'
  20037. members behave according to `#defines', as follows:
  20038.  
  20039. `default'
  20040.      If you specify no `#define', the `.x.' branch has "`ax'" members
  20041.      and is 32-bit.  This is compatible with previous versions of djgpp.
  20042.  
  20043. `_NAIVE_DOS_REGS'
  20044.      This define gives you `.x.ax', but they are 16-bit.  This is
  20045.      probably what most programs ported from 16-bit dos compilers will
  20046.      want.
  20047.  
  20048. `_BORLAND_DOS_REGS'
  20049.      This define gives you `.x.eax' which are 32-bit.  This is
  20050.      compatible with Borland's 32-bit compilers.
  20051.  
  20052. This function simulates a software interrupt.  Note that, unlike the
  20053. `__dpmi_int' function, requests that go through `int86' and similar
  20054. functions are specially processed to make them suitable for invoking
  20055. real-mode interrupts from protected-mode programs.  For example, if a
  20056. particular routine takes a pointer in `BX', `int86' expects you to put
  20057. a (protected-mode) pointer in `EBX'.  Therefore, `int86' should have
  20058. specific support for every interrupt and function you invoke this way.
  20059. Currently, it supports only a subset of all available interrupts and
  20060. functions:
  20061.  
  20062. 1) All functions of any interrupt which expects only scalar arguments
  20063. registers (i.e., no pointers to buffers).
  20064.  
  20065. 2) In addition, the following functions of interrupt 21h are supported:
  20066. 9, 39h, 3Ah, 3Bh, 3Ch, 3Dh, 3Fh, 40h, 41h, 43h, 47h, 56h.
  20067.  
  20068. When the interrupt is invoked, the CPU registers are copied from IN.
  20069. After the interrupt, the CPU registers are copied to OUT.
  20070.  
  20071. This function is just like `int86x' (*note int86x::.) except that
  20072. suitable default values are used for the segment registers.
  20073.  
  20074. See also *Note int86x::, *Note intdos::, and *Note bdos::.
  20075.  
  20076. Return Value
  20077. ------------
  20078.  
  20079. The returned value of `EAX'.
  20080.  
  20081. Portability
  20082. -----------
  20083.  
  20084. not ANSI, not POSIX
  20085.  
  20086. Example
  20087. -------
  20088.  
  20089.      union REGS r;
  20090.      r.x.ax = 0x0100;
  20091.      r.h.dl = 'c';
  20092.      int86(0x21, &r, &r);
  20093.  
  20094. 
  20095. File: libc.info,  Node: int86x,  Next: intdos,  Prev: int86,  Up: Alphabetical List
  20096.  
  20097. int86x
  20098. ======
  20099.  
  20100. Syntax
  20101. ------
  20102.  
  20103.      #include <dos.h>
  20104.      
  20105.      int int86x(int ivec, union REGS *in, union REGS *out, struct SREGS *seg);
  20106.  
  20107. Description
  20108. -----------
  20109.  
  20110. This function is just like `int86' (*note int86::.) except that values
  20111. you pass in SREGS are used for the segment registers instead of the
  20112. defaults.
  20113.  
  20114. See also *Note int86::, *Note intdos::, and *Note bdos::.
  20115.  
  20116. Return Value
  20117. ------------
  20118.  
  20119. The value of `EAX' is returned.
  20120.  
  20121. Portability
  20122. -----------
  20123.  
  20124. not ANSI, not POSIX
  20125.  
  20126. Example
  20127. -------
  20128.  
  20129.      union REGS r;
  20130.      struct SREGS s;
  20131.      r.h.ah = 0x31;
  20132.      r.h.dl = 'c';
  20133.      r.x.si = si_val;
  20134.      s.ds = ds_val;
  20135.      int86x(0x21, &r, &r, &s);
  20136.  
  20137. 
  20138. File: libc.info,  Node: intdos,  Next: intdosx,  Prev: int86x,  Up: Alphabetical List
  20139.  
  20140. intdos
  20141. ======
  20142.  
  20143. Syntax
  20144. ------
  20145.  
  20146.      #include <dos.h>
  20147.      
  20148.      int intdos(union REGS *in, union REGS *out);
  20149.  
  20150. Description
  20151. -----------
  20152.  
  20153. This function is just like `int86' (*note int86x::.) except that the
  20154. interrupt vector is 0x21.
  20155.  
  20156. Return Value
  20157. ------------
  20158.  
  20159. `EAX'
  20160.  
  20161. Portability
  20162. -----------
  20163.  
  20164. not ANSI, not POSIX
  20165.  
  20166. 
  20167. File: libc.info,  Node: intdosx,  Next: intensevideo,  Prev: intdos,  Up: Alphabetical List
  20168.  
  20169. intdosx
  20170. =======
  20171.  
  20172. Syntax
  20173. ------
  20174.  
  20175.      #include <dos.h>
  20176.      
  20177.      int intdosx(union REGS *in, union REGS *out, struct SREGS *s);
  20178.  
  20179. Description
  20180. -----------
  20181.  
  20182. This function is just like `int86x' (*note int86x::.) except that the
  20183. interrupt vector is 0x21.
  20184.  
  20185. Return Value
  20186. ------------
  20187.  
  20188. `EAX'
  20189.  
  20190. Portability
  20191. -----------
  20192.  
  20193. not ANSI, not POSIX
  20194.  
  20195. 
  20196. File: libc.info,  Node: intensevideo,  Next: _invent_inode,  Prev: intdosx,  Up: Alphabetical List
  20197.  
  20198. intensevideo
  20199. ============
  20200.  
  20201. Syntax
  20202. ------
  20203.  
  20204.      #include <conio.h>
  20205.      
  20206.      void intensevideo(void);
  20207.  
  20208. Description
  20209. -----------
  20210.  
  20211. Bit 7 (`MSB') of the character attribute byte has two possible effects
  20212. on EGA and VGA displays: it can either make the character blink or
  20213. change the background color to bright (thus allowing for 16 background
  20214. colors as opposed to the usual 8).  This function sets that bit to
  20215. display bright background colors.  After a call to this function, every
  20216. character written to the screen with bit 7 of the attribute byte set,
  20217. will have a bright background color.  The companion function
  20218. `blinkvideo' (*note blinkvideo::.) has the opposite effect.
  20219.  
  20220. Note that there is no BIOS function to get the current status of this
  20221. bit, but bit 5 of the byte at `0040h:0065h' in the BIOS area indicates
  20222. the current state: if it's 1 (the default), blinking characters will be
  20223. displayed.
  20224.  
  20225. Portability
  20226. -----------
  20227.  
  20228. not ANSI, not POSIX
  20229.  
  20230. 
  20231. File: libc.info,  Node: _invent_inode,  Next: ioctl (DOS),  Prev: intensevideo,  Up: Alphabetical List
  20232.  
  20233. _invent_inode
  20234. =============
  20235.  
  20236. Syntax
  20237. ------
  20238.  
  20239.      ino_t
  20240.      _invent_inode(const char *name, unsigned time_stamp, unsigned long fsize)
  20241.  
  20242. Description
  20243. -----------
  20244.  
  20245. This invents an inode number for those files which don't have valid DOS
  20246. cluster number.  These could be:
  20247.    *  devices like `/dev/null' or file system extensions  (*note File
  20248.      System Extensions::.)
  20249.  
  20250.    *  empty files which were not allocated disk space yet
  20251.  
  20252.    *  or files on networked drives, for which the redirector doesn't
  20253.      bring the  cluster number.
  20254.  
  20255. To ensure proper operation of this function, you must call it with a
  20256. filename in some canonical form.  E.g., with a name returned by
  20257. `truename()' (*note _truename::.), or that returned by `_fixpath()'
  20258. (*note _fixpath::.).  The point here is that the entire program *must*
  20259. abide by these conventions through its operation, or else you risk
  20260. getting different inode numbers for the same file.
  20261.  
  20262. Return Value
  20263. ------------
  20264.  
  20265. 0 on error, otherwise the invented inode number for the file
  20266.  
  20267. Portability
  20268. -----------
  20269.  
  20270. not ANSI, not POSIX
  20271.  
  20272. 
  20273. File: libc.info,  Node: ioctl (DOS),  Next: ioctl (General description),  Prev: _invent_inode,  Up: Alphabetical List
  20274.  
  20275. ioctl (DOS)
  20276. ===========
  20277.  
  20278. The DOSish version of `ioctl' performs an interrupt 0x21, function
  20279. 0x44. It takes care of supplying transfer buffers in low address
  20280. regions, if they are needed. For an exhaustive description of the
  20281. various commands and subcommands, see Ralf Brown's interrupt list.
  20282.  
  20283. It is highly recommended to use only the DOS_* functions listed in
  20284. `sys/ioctl.h'.
  20285.  
  20286. Syntax
  20287. ------
  20288.  
  20289.      #include <sys/ioctl.h>
  20290.      
  20291.      int ioctl(int fd, int cmd, ... );
  20292.  
  20293. Description
  20294. -----------
  20295.  
  20296. The parameter `fd' must refer to a file descriptor for character device
  20297. functions, or the number of a block device (usually current=0, A:=1,
  20298. ...).
  20299.  
  20300. The following constants can be used for the `cmd' parameter:
  20301. `DOS_GETDEVDATA'
  20302.      Get device information. Returns the device information word from
  20303.      `DX'.  The call to `ioctl' should look like this:
  20304.  
  20305.            int ret_val = ioctl (fd, DOS_GETDEVDATA);
  20306.  
  20307.      For another way of achieving the same effect, see *Note
  20308.      _get_dev_info::.
  20309.  
  20310. `DOS_SETDEVDATA'
  20311.      Set device information. Returns the new device information word
  20312.      form `DX' or -1.  The call to `ioctl' should look like this:
  20313.  
  20314.            int ret_val = ioctl (fd, DOS_SETDEVDATA, 0, dev_info);
  20315.  
  20316. `DOS_RCVDATA'
  20317.      Read from character device control channel. After `cmd' must
  20318.      follow the number of requested bytes to read and a pointer to a
  20319.      buffer. Returns the number of bytes actually read or -1 on error.
  20320.      The call to `ioctl' should look like this:
  20321.  
  20322.            unsigned char buf[bytes_to_read];
  20323.            int ret_val = ioctl (fd, DOS_RCVDATA, bytes_to_read, &buf);
  20324.  
  20325. `DOS_SNDDATA'
  20326.      Write to character device control channel. After `cmd' must follow
  20327.      the number of bytes to write and a pointer to a buffer holding the
  20328.      data.  Returns the number of bytes actually written.  An example
  20329.      of a call:
  20330.  
  20331.            unsigned char buf[bytes_to_write];
  20332.            int ret_val = ioctl (fd, DOS_SNDDATA, bytes_to_write, &buf);
  20333.  
  20334. `DOS_RCVCTLDATA'
  20335.      Read from block device control channel. See `DOS_RCVDATA'.
  20336.  
  20337. `DOS_SNDCTLDATA'
  20338.      Write to block device control channel. See `DOS_SNDDATA'.
  20339.  
  20340. `DOS_CHKINSTAT'
  20341.      Check the input status of a file. Returns 0 if not ready of at
  20342.      EOF, `0xff' if file is ready.  Here's an example of how to call:
  20343.  
  20344.            int ret_val = ioctl (fd, DOS_CHKINSTAT);
  20345.  
  20346.      A more portable way of doing this is by calling `select'.  *Note
  20347.      select::.
  20348.  
  20349. `DOS_CHKOUTSTAT'
  20350.      Check the output status of a file. Returns 0 if not ready of at
  20351.      EOF, `0xff' if file is ready.  `select' (*note select::.) is
  20352.      another, more portable way of doing the same.
  20353.  
  20354. `DOS_ISCHANGEABLE'
  20355.      Check if a block device is changeable. Returns 0 for removable or
  20356.      1 for fixed.  An example of a call:
  20357.  
  20358.            int ret_val = ioctl (fd, DOS_ISCHANGEABLE);
  20359.  
  20360. `DOS_ISREDIRBLK'
  20361.      Check if a block device is remote o local.  The function
  20362.      `_is_remote_drive' (*note _is_remote_drive::.) is another way of
  20363.      returning the same info.
  20364.  
  20365. `DOS_ISREDIRHND'
  20366.      Check if a file handle refers to a local or remote device.  See
  20367.      *Note _is_remote_handle:: for another way of doing this.
  20368.  
  20369. `DOS_SETRETRY'
  20370.      Set the sharing retry count. The first extra parameter specifies
  20371.      the pause between retries, the second number of retries.  An
  20372.      example:
  20373.  
  20374.            int ret_val = ioctl (fd, DOS_SETRETRY, pause_between_retries, max_retries);
  20375.  
  20376. `DOS_GENCHARREQ'
  20377.      Generic character device request.  Example:
  20378.  
  20379.            int ret_val = ioctl (fd, DOS_GENCHARREQ, category_and_function,
  20380.                                 ¶m_block, si_value, di_value, param_block_size);
  20381.  
  20382.      Refer to Ralf Brown's Interrupt List for the details about each
  20383.      function and relevant parameter block layout.
  20384.  
  20385. `DOS_GENBLKREQ'
  20386.      Generic block device request.  Example of the call:
  20387.  
  20388.            int ret_val = ioctl (drive_no, DOS_GENBLKREQ, category_and_function,
  20389.                                 ¶m_block, si_value, di_value, param_block_size);
  20390.  
  20391.      Note that instead of the handle, the first argument is the disk
  20392.      drive number (0 = default, 1 = A:, etc.).
  20393.  
  20394. `DOS_GLDRVMAP'
  20395.      Get logical drive map.  A call like the following:
  20396.  
  20397.            int ret_val = ioctl (drive_no, DOS_GLDRVMAP);
  20398.  
  20399.      will return 0 if the block device has only one logical drive
  20400.      assigned, or a number in the range 1..26 which is the last drive
  20401.      numer used to reference that drive (1 = A:, etc.).  Thus, on a
  20402.      machine which has a single floppy drive, calling `ioctl (1,
  20403.      DOS_GLDRVMAP);' will return 2 if the floppy was last refered to as
  20404.      B:.  This function and the next one can be used together to
  20405.      prevent DOS from popping the ugly prompt saying "Insert diskette
  20406.      for drive B: and press any key when ready".
  20407.  
  20408. `DOS_SLDRVMAP'
  20409.      Set logical drive map.  For example, a call like this:
  20410.  
  20411.            ioctl (1, DOS_SLDRVMAP);
  20412.  
  20413.      will cause drive A: to be mapped to drive B:.
  20414.  
  20415. `DOS_QGIOCTLCAPH'
  20416.      Query generic ioctl capability (handle). Test if a handle supports
  20417.      ioctl functions beyond those in the standard DOS 3.2 set.  Call
  20418.      like this:
  20419.  
  20420.            int ret_val = ioctl (fd, DOS_QGIOCTLCAPH, category_and_function);
  20421.  
  20422.      This will return zero if the specified IOCTL function is
  20423.      supported, 1 if not.
  20424.  
  20425. `DOS_QGIOCTLCAPD'
  20426.      Query generic ioctl capability (drive). Test if a drive supports
  20427.      ioctl functions beyond those in the standard DOS 3.2 set.  Used
  20428.      same as DOS_QGIOCTLCAPH, but the first argument is a drive number
  20429.      (0 = default, 1 = A:, etc.), not a handle.
  20430.  
  20431. If your specific device driver requires different commands, they must
  20432. be or'ed together with the flags listed in `<sys/ioctl.h>' to tell the
  20433. drive about transfer buffers and what to return.
  20434.  
  20435. Return Value
  20436. ------------
  20437.  
  20438. See description above.
  20439.  
  20440. Device information word
  20441. -----------------------
  20442.  
  20443. The bits of the device information word have the following meaning:\\
  20444. Character device:
  20445.      14  Device driver can process IOCTL request
  20446.  
  20447.      13  output until busy supported
  20448.  
  20449.      11  driver supports OPEN/CLOSE calls
  20450.  
  20451.      7   set (indicates device)
  20452.  
  20453.      6   EOF on input
  20454.  
  20455.      5   raw (binary) mode
  20456.  
  20457.      4   device is special (uses INT 29)
  20458.  
  20459.      3   clock device
  20460.  
  20461.      2   NUL device
  20462.  
  20463.      1   standard output
  20464.  
  20465.      0   standard input
  20466.  
  20467. Disk file:
  20468.      15  file is remote (DOS 3.0+)
  20469.  
  20470.      14  don't set file date/time on closing (DOS 3.0+)
  20471.  
  20472.      11  media not removable
  20473.  
  20474.      8   (DOS 4 only) generate INT 24 if no disk space on write or read
  20475.      past end of file
  20476.  
  20477.      7   clear (indicates file)
  20478.  
  20479.      6   file has not been written
  20480.  
  20481.      5-0 drive number (0 = A:)
  20482.  
  20483. Example
  20484. -------
  20485.  
  20486.      #include <sys/ioctl.h>
  20487.      int main(int argc, char **argv){
  20488.         char buf[6];
  20489.         short *s;
  20490.      
  20491.         open(fd,"EMMQXXX0",O_RDONLY);
  20492.         mybuf[0] = '\0';
  20493.         s = mybuf;
  20494.         ioctl(fd,DOS_SNDDATA,6, (int) &mybuf);
  20495.         if(*s ==0x25 )printf("EMM386 >= 4.45\n");
  20496.         mybuf[0]='\x02';
  20497.         ioctl(fd,DOS_SNDDATA,2,(int )&mybuf);
  20498.         printf("EMM Version %d.%d\n",(int )mybuf[0],(int) mybuf[1]);
  20499.         close(fd);
  20500.      }
  20501.  
  20502. 
  20503. File: libc.info,  Node: ioctl (General description),  Next: ioctl (UNIX),  Prev: ioctl (DOS),  Up: Alphabetical List
  20504.  
  20505. ioctl (General description)
  20506. ===========================
  20507.  
  20508. `ioctl' performs low level calls to communicate with device drivers. As
  20509. there are lots of different device drivers, no really general
  20510. description is possible.
  20511.  
  20512. The DJGPP version tries to cope with two different flavors of `ioctl',
  20513. a DOSish and a UNIXish way. To distinguish between DOS-like and
  20514. UNIX-like calls, all valid DOS commands have all 3 MSB set to 0, the
  20515. UNIX command have at least one of the 3 MSB set to 1.
  20516.  
  20517. 
  20518. File: libc.info,  Node: ioctl (UNIX),  Next: _is_executable,  Prev: ioctl (General description),  Up: Alphabetical List
  20519.  
  20520. ioctl (UNIX)
  20521. ============
  20522.  
  20523. The UNIX version first checks if an FSE handler is associated to the
  20524. file descriptor. If so, it calls the handler in the usual way *Note
  20525. File System Extensions::. Otherwise it sets ERRNO to `ENOTTY' and
  20526. returns -1.
  20527.  
  20528. As this part is still under development, it should not be used
  20529. exhaustively.
  20530.  
  20531. 
  20532. File: libc.info,  Node: _is_executable,  Next: _is_remote_drive,  Prev: ioctl (UNIX),  Up: Alphabetical List
  20533.  
  20534. _is_executable
  20535. ==============
  20536.  
  20537. Syntax
  20538. ------
  20539.  
  20540.      #include <sys/stat.h>
  20541.      
  20542.      int _is_executable(const char *path, int fhandle, const char *extension);
  20543.  
  20544. Description
  20545. -----------
  20546.  
  20547. This function determines if a file is executable under DOS/DJGPP
  20548. environment.  The file may be given either by its PATH or its file
  20549. handle FHANDLE.  If EXTENSION is non-NULL and non-empty, it is used
  20550. first to look up in a list of known extensions which determine whether
  20551. the file is executable.  (If the `_STAT_EXEC_EXT' bit of the
  20552. `_djstat_flags' global variable (*note _djstat_flags::.) is not set,
  20553. this step is skipped.)  If EXTENSION is unavailable or not enough to
  20554. determine the result, the first 2 bytes of the file are checked to
  20555. contain one of the known `magic numbers' identifying the file as
  20556. executable.  If the file's 2 first bytes need to be read but the read
  20557. fails, 0 is returned and errno is set.  (The file is only searched for
  20558. magic number if the `_STAT_EXEC_MAGIC' bit of the `_djstat_flags'
  20559. variable is set.)
  20560.  
  20561. Note that if `_STAT_EXEC_MAGIC' is set, but `_STAT_EXEC_EXT' is not,
  20562. some files which shouldn't be flagged as executables (e.g., COFF `*.o'
  20563. object files) will have their execute bit set, because they have the
  20564. magic number signature at their beginning.  Therefore, only use the
  20565. above combination if you want to debug the list of extensions provided
  20566. in `is_exec.c' file from the library sources.
  20567.  
  20568. If the file passed by its handle was open as write-only, and the
  20569. extension alone isn't enough to determine whether the file is
  20570. executable, then this function returns 0, because it cannot look at the
  20571. `magic number'.
  20572.  
  20573. This function is used internally by `f?stat'; you are not supposed to
  20574. call it directly.
  20575.  
  20576. Return Value
  20577. ------------
  20578.  
  20579. 1 for executable file, 0 otherwise (including in case of errors in
  20580. accessing the file).
  20581.  
  20582. Portability
  20583. -----------
  20584.  
  20585. not ANSI, not POSIX
  20586.  
  20587. 
  20588. File: libc.info,  Node: _is_remote_drive,  Next: _is_remote_handle,  Prev: _is_executable,  Up: Alphabetical List
  20589.  
  20590. _is_remote_drive
  20591. ================
  20592.  
  20593. Syntax
  20594. ------
  20595.  
  20596.      int _is_remote_drive(int drv);
  20597.  
  20598. Description
  20599. -----------
  20600.  
  20601. Given the drive number in DRV (A: = 0, B: = 1, etc.), this function
  20602. returns non-zero if the drive is treated by DOS as a remote (networked)
  20603. drive, or zero otherwise.  It does so by calling subfunction 09h of the
  20604. DOS IOCTL function (interrupt 21h, AX=4409h) and looking at bit 12 of
  20605. the device attribute word returned in the DX register.
  20606.  
  20607. Note that DOS treats CD-ROM drives as remote.
  20608.  
  20609. Return Value
  20610. ------------
  20611.  
  20612. Zero for local drives, non-zero for remote and CD-ROM drives.
  20613.  
  20614. Portability
  20615. -----------
  20616.  
  20617. not ANSI, not POSIX
  20618.  
  20619. 
  20620. File: libc.info,  Node: _is_remote_handle,  Next: isalnum,  Prev: _is_remote_drive,  Up: Alphabetical List
  20621.  
  20622. _is_remote_handle
  20623. =================
  20624.  
  20625. Syntax
  20626. ------
  20627.  
  20628.      int _is_remote_handle(int fhandle);
  20629.  
  20630. Description
  20631. -----------
  20632.  
  20633. Given the file handle of an open file in FHANDLE, this function returns
  20634. non-zero if the drive where that file resides is treated by DOS as a
  20635. remote (networked) drive, or zero otherwise.  It does so by calling
  20636. subfunction 0Ah of the DOS IOCTL function (interrupt 21h, AX=440Ah) and
  20637. looking at bit 15 of the device attribute word returned in the DX
  20638. register.
  20639.  
  20640. Note that DOS treats CD-ROM drives as remote.
  20641.  
  20642. Return Value
  20643. ------------
  20644.  
  20645. Zero for files on local drives, non-zero for files on remote and CD-ROM
  20646. drives.
  20647.  
  20648. Portability
  20649. -----------
  20650.  
  20651. not ANSI, not POSIX
  20652.  
  20653. 
  20654. File: libc.info,  Node: isalnum,  Next: isalpha,  Prev: _is_remote_handle,  Up: Alphabetical List
  20655.  
  20656. isalnum
  20657. =======
  20658.  
  20659. Syntax
  20660. ------
  20661.  
  20662.      #include <ctype.h>
  20663.      
  20664.      int isalnum(int c);
  20665.  
  20666. Description
  20667. -----------
  20668.  
  20669. Tells if C is any letter or digit.
  20670.  
  20671. Return Value
  20672. ------------
  20673.  
  20674. Nonzero if C is a letter or digit, else zero.
  20675.  
  20676. Portability
  20677. -----------
  20678.  
  20679. ANSI, POSIX
  20680.  
  20681. 
  20682. File: libc.info,  Node: isalpha,  Next: isascii,  Prev: isalnum,  Up: Alphabetical List
  20683.  
  20684. isalpha
  20685. =======
  20686.  
  20687. Syntax
  20688. ------
  20689.  
  20690.      #include <ctype.h>
  20691.      
  20692.      int isalpha(int c);
  20693.  
  20694. Description
  20695. -----------
  20696.  
  20697. Tells if C is a letter.
  20698.  
  20699. Return Value
  20700. ------------
  20701.  
  20702. Nonzero if C is a letter, else zero.
  20703.  
  20704. Portability
  20705. -----------
  20706.  
  20707. ANSI, POSIX
  20708.  
  20709. 
  20710. File: libc.info,  Node: isascii,  Next: isatty,  Prev: isalpha,  Up: Alphabetical List
  20711.  
  20712. isascii
  20713. =======
  20714.  
  20715. Syntax
  20716. ------
  20717.  
  20718.      #include <ctype.h>
  20719.      
  20720.      int isascii(int c);
  20721.  
  20722. Description
  20723. -----------
  20724.  
  20725. Tells if C is an ASCII character (0x00 to 0x7f).
  20726.  
  20727. Return Value
  20728. ------------
  20729.  
  20730. Nonzero if C is ASCII, else zero.
  20731.  
  20732. Portability
  20733. -----------
  20734.  
  20735. not ANSI, not POSIX
  20736.  
  20737. 
  20738. File: libc.info,  Node: isatty,  Next: iscntrl,  Prev: isascii,  Up: Alphabetical List
  20739.  
  20740. isatty
  20741. ======
  20742.  
  20743. Syntax
  20744. ------
  20745.  
  20746.      #include <unistd.h>
  20747.      
  20748.      int isatty(int fd);
  20749.  
  20750. Description
  20751. -----------
  20752.  
  20753. Tells if the file descriptor refers to a terminal device or not.
  20754.  
  20755. Return Value
  20756. ------------
  20757.  
  20758. Nonzero if FD is a terminal device, zero  otherwise.
  20759.  
  20760. Portability
  20761. -----------
  20762.  
  20763. not ANSI, POSIX
  20764.  
  20765. Example
  20766. -------
  20767.  
  20768.      if (isatty(1))
  20769.        fflush(stdout);
  20770.  
  20771. 
  20772. File: libc.info,  Node: iscntrl,  Next: isdigit,  Prev: isatty,  Up: Alphabetical List
  20773.  
  20774. iscntrl
  20775. =======
  20776.  
  20777. Syntax
  20778. ------
  20779.  
  20780.      #include <ctype.h>
  20781.      
  20782.      int iscntrl(int c);
  20783.  
  20784. Description
  20785. -----------
  20786.  
  20787. Tells if C is a control character.
  20788.  
  20789. Return Value
  20790. ------------
  20791.  
  20792. Nonzero if C is a control character, else zero.
  20793.  
  20794. Portability
  20795. -----------
  20796.  
  20797. ANSI, POSIX
  20798.  
  20799. 
  20800. File: libc.info,  Node: isdigit,  Next: isgraph,  Prev: iscntrl,  Up: Alphabetical List
  20801.  
  20802. isdigit
  20803. =======
  20804.  
  20805. Syntax
  20806. ------
  20807.  
  20808.      #include <ctype.h>
  20809.      
  20810.      int isdigit(int c);
  20811.  
  20812. Description
  20813. -----------
  20814.  
  20815. Tells if C is a digit.
  20816.  
  20817. Return Value
  20818. ------------
  20819.  
  20820. Nonzero if C is a digit, else zero.
  20821.  
  20822. Portability
  20823. -----------
  20824.  
  20825. ANSI, POSIX
  20826.  
  20827. 
  20828. File: libc.info,  Node: isgraph,  Next: islower,  Prev: isdigit,  Up: Alphabetical List
  20829.  
  20830. isgraph
  20831. =======
  20832.  
  20833. Syntax
  20834. ------
  20835.  
  20836.      #include <ctype.h>
  20837.      
  20838.      int isgraph(int c);
  20839.  
  20840. Description
  20841. -----------
  20842.  
  20843. Tells if C is a visible printing character.  Space is not included.
  20844.  
  20845. Return Value
  20846. ------------
  20847.  
  20848. Nonzero if C is a visible printing character, else zero.
  20849.  
  20850. Portability
  20851. -----------
  20852.  
  20853. ANSI, POSIX
  20854.  
  20855. 
  20856. File: libc.info,  Node: islower,  Next: isprint,  Prev: isgraph,  Up: Alphabetical List
  20857.  
  20858. islower
  20859. =======
  20860.  
  20861. Syntax
  20862. ------
  20863.  
  20864.      #include <ctype.h>
  20865.      
  20866.      int islower(int c);
  20867.  
  20868. Description
  20869. -----------
  20870.  
  20871. Tells if C is lower case or not.
  20872.  
  20873. Return Value
  20874. ------------
  20875.  
  20876. Nonzero if C is lower case, else zero.
  20877.  
  20878. Portability
  20879. -----------
  20880.  
  20881. ANSI, POSIX
  20882.  
  20883. 
  20884. File: libc.info,  Node: isprint,  Next: ispunct,  Prev: islower,  Up: Alphabetical List
  20885.  
  20886. isprint
  20887. =======
  20888.  
  20889. Syntax
  20890. ------
  20891.  
  20892.      #include <ctype.h>
  20893.      
  20894.      int isprint(int c);
  20895.  
  20896. Description
  20897. -----------
  20898.  
  20899. Tells if C is a printing character, which includes the space character.
  20900.  
  20901. Return Value
  20902. ------------
  20903.  
  20904. Nonzero if C is a printing character, else zero.
  20905.  
  20906. Portability
  20907. -----------
  20908.  
  20909. ANSI, POSIX
  20910.  
  20911. 
  20912. File: libc.info,  Node: ispunct,  Next: isspace,  Prev: isprint,  Up: Alphabetical List
  20913.  
  20914. ispunct
  20915. =======
  20916.  
  20917. Syntax
  20918. ------
  20919.  
  20920.      #include <ctype.h>
  20921.      
  20922.      int ispunct(int c);
  20923.  
  20924. Description
  20925. -----------
  20926.  
  20927. Tells if C is any printing character except space and those indicated
  20928. by `isalnum'.
  20929.  
  20930. Return Value
  20931. ------------
  20932.  
  20933. Nonzero if C is punctuation, else zero.
  20934.  
  20935. Portability
  20936. -----------
  20937.  
  20938. ANSI, POSIX
  20939.  
  20940. 
  20941. File: libc.info,  Node: isspace,  Next: isupper,  Prev: ispunct,  Up: Alphabetical List
  20942.  
  20943. isspace
  20944. =======
  20945.  
  20946. Syntax
  20947. ------
  20948.  
  20949.      #include <ctype.h>
  20950.      
  20951.      int isspace(int c);
  20952.  
  20953. Description
  20954. -----------
  20955.  
  20956. Tells if C is whitespace, that is, carriage return, newline, form feed,
  20957. tab, vertical tab, or space.
  20958.  
  20959. Return Value
  20960. ------------
  20961.  
  20962. Nonzero if C is whitespace, else zero.
  20963.  
  20964. Portability
  20965. -----------
  20966.  
  20967. ANSI, POSIX
  20968.  
  20969. 
  20970. File: libc.info,  Node: isupper,  Next: isxdigit,  Prev: isspace,  Up: Alphabetical List
  20971.  
  20972. isupper
  20973. =======
  20974.  
  20975. Syntax
  20976. ------
  20977.  
  20978.      #include <ctype.h>
  20979.      
  20980.      int isupper(int c);
  20981.  
  20982. Description
  20983. -----------
  20984.  
  20985. Tells if C is an upper case character or not.
  20986.  
  20987. Return Value
  20988. ------------
  20989.  
  20990. Nonzero if C is upper case, else zero.
  20991.  
  20992. Portability
  20993. -----------
  20994.  
  20995. ANSI, POSIX
  20996.  
  20997. 
  20998. File: libc.info,  Node: isxdigit,  Next: itoa,  Prev: isupper,  Up: Alphabetical List
  20999.  
  21000. isxdigit
  21001. ========
  21002.  
  21003. Syntax
  21004. ------
  21005.  
  21006.      #include <ctype.h>
  21007.      
  21008.      int isxdigit(int c);
  21009.  
  21010. Description
  21011. -----------
  21012.  
  21013. Tells if C is a valid hexadecimal digit or not.  This includes
  21014. `[0-9a-fA-F]'.
  21015.  
  21016. Return Value
  21017. ------------
  21018.  
  21019. Nonzero if C is a hex digit, else zero.
  21020.  
  21021. Portability
  21022. -----------
  21023.  
  21024. ANSI, POSIX
  21025.  
  21026. 
  21027. File: libc.info,  Node: itoa,  Next: kbhit,  Prev: isxdigit,  Up: Alphabetical List
  21028.  
  21029. itoa
  21030. ====
  21031.  
  21032. Syntax
  21033. ------
  21034.  
  21035.      #include <stdlib.h>
  21036.      
  21037.      char * itoa(int value, char *string, int radix)
  21038.  
  21039. Description
  21040. -----------
  21041.  
  21042. This function converts its argument VALUE into a null-terminated
  21043. character string using RADIX as the base of the number system.  The
  21044. resulting string with a length of upto 33 bytes (including the optional
  21045. sign and the terminating `NULL' is put into the buffer whose address is
  21046. given by STRING.  For radixes other than 10, VALUE is treated as an
  21047. unsigned int (i.e., the sign bit is not interpreted as such).  The
  21048. argument RADIX should specify the base, between 2 and 36, in which the
  21049. string reprsentation of VALUE is requested.
  21050.  
  21051. Return Value
  21052. ------------
  21053.  
  21054. A pointer to STRING.
  21055.  
  21056. Portability
  21057. -----------
  21058.  
  21059. not ANSI, not POSIX
  21060.  
  21061. Example
  21062. -------
  21063.  
  21064.      char binary_str[33];
  21065.      
  21066.      (void)itoa(num, binary_str, 2);
  21067.  
  21068. 
  21069. File: libc.info,  Node: kbhit,  Next: kill,  Prev: itoa,  Up: Alphabetical List
  21070.  
  21071. kbhit
  21072. =====
  21073.  
  21074. Syntax
  21075. ------
  21076.  
  21077.      #include <pc.h>
  21078.      
  21079.      int kbhit(void);
  21080.  
  21081. Description
  21082. -----------
  21083.  
  21084. If the user has hit a key, this function will detect it.  This function
  21085. is very fast when there is no key waiting, so it may be used inside
  21086. loops as needed.
  21087.  
  21088. If you test shift/alt/ctrl status with bios calls (e.g., using `bioskey
  21089. (2)' or `bioskey (0x12)') then you should also use bios calls for
  21090. testing for keys.  This can be done with by `bioskey (1)' or `bioskey
  21091. (0x11)'.  Failing to do so can cause trouble in multitasking
  21092. environments like DESQview/X.
  21093.  
  21094. Return Value
  21095. ------------
  21096.  
  21097. Nonzero if a key has been hit, else zero.
  21098.  
  21099. Portability
  21100. -----------
  21101.  
  21102. not ANSI, not POSIX
  21103.  
  21104. Example
  21105. -------
  21106.  
  21107.      while (!kbhit())
  21108.        do_stuff();
  21109.  
  21110. 
  21111. File: libc.info,  Node: kill,  Next: labs,  Prev: kbhit,  Up: Alphabetical List
  21112.  
  21113. kill
  21114. ====
  21115.  
  21116. Syntax
  21117. ------
  21118.  
  21119.      #include <signal.h>
  21120.      
  21121.      int    kill(pid_t _pid, int _sig);
  21122.  
  21123. Description
  21124. -----------
  21125.  
  21126. If _PID is the current `getpid()', the given _SIG is raised with *Note
  21127. raise::.
  21128.  
  21129. Return Value
  21130. ------------
  21131.  
  21132. -1 on error, else zero.
  21133.  
  21134. Portability
  21135. -----------
  21136.  
  21137. not ANSI, POSIX
  21138.  
  21139. 
  21140. File: libc.info,  Node: labs,  Next: ldexp,  Prev: kill,  Up: Alphabetical List
  21141.  
  21142. labs
  21143. ====
  21144.  
  21145. Syntax
  21146. ------
  21147.  
  21148.      #include <stdlib.h>
  21149.      
  21150.      long labs(long x);
  21151.  
  21152. Description
  21153. -----------
  21154.  
  21155. This function takes the absolute value of X.  *Note abs::.
  21156.  
  21157. Return Value
  21158. ------------
  21159.  
  21160. |X|
  21161.  
  21162. Portability
  21163. -----------
  21164.  
  21165. ANSI, POSIX
  21166.  
  21167. 
  21168. File: libc.info,  Node: ldexp,  Next: ldiv,  Prev: labs,  Up: Alphabetical List
  21169.  
  21170. ldexp
  21171. =====
  21172.  
  21173. Syntax
  21174. ------
  21175.  
  21176.      #include <math.h>
  21177.      
  21178.      double ldexp(double val, int exp);
  21179.  
  21180. Description
  21181. -----------
  21182.  
  21183. This function computes VAL*2^EXP.
  21184.  
  21185. Return Value
  21186. ------------
  21187.  
  21188. VAL*2^EXP.  `ldexp(0., exp)' returns 0 for all values of `exp', without
  21189. setting `errno'.  For non-zero values of VAL, `errno' is set to
  21190. `ERANGE' if the result cannot be accurately represented by a `double',
  21191. and the return value is then the nearest representable `double'
  21192. (possibly, an `Inf').  If VAL is a `NaN' or `Inf', the return value is
  21193. `NaN' and `errno' is set to `EDOM'.
  21194.  
  21195. Portability
  21196. -----------
  21197.  
  21198. ANSI, POSIX
  21199.  
  21200. Example
  21201. -------
  21202.  
  21203.      ldexp(3.5,4) == 3.5 * (2^4) == 56.0
  21204.  
  21205. 
  21206. File: libc.info,  Node: ldiv,  Next: _lfn_gen_short_fname,  Prev: ldexp,  Up: Alphabetical List
  21207.  
  21208. ldiv
  21209. ====
  21210.  
  21211. Syntax
  21212. ------
  21213.  
  21214.      #include <stdlib.h>
  21215.      
  21216.      ldiv_t ldiv(long numerator, long denominator);
  21217.  
  21218. Description
  21219. -----------
  21220.  
  21221. Returns the quotient and remainder of the division NUMERATOR divided by
  21222. DENOMINATOR.  The return type is as follows:
  21223.  
  21224.      typedef struct {
  21225.        long quot;
  21226.        long rem;
  21227.      } ldiv_t;
  21228.  
  21229. Return Value
  21230. ------------
  21231.  
  21232. The results of the division are returned.
  21233.  
  21234. Portability
  21235. -----------
  21236.  
  21237. ANSI, POSIX
  21238.  
  21239. Example
  21240. -------
  21241.  
  21242.      ldiv_t l = ldiv(42, 3);
  21243.      printf("42 = %ld x 3 + %ld\n", l.quot, l.rem);
  21244.      
  21245.      ldiv(+40, +3) = { +13, +1 }
  21246.      ldiv(+40, -3) = { -13, -1 }
  21247.      ldiv(-40, +3) = { -13, -1 }
  21248.      ldiv(-40, -3) = { +13, -1 }
  21249.  
  21250. 
  21251. File: libc.info,  Node: _lfn_gen_short_fname,  Next: _lfn_get_ftime,  Prev: ldiv,  Up: Alphabetical List
  21252.  
  21253. _lfn_gen_short_fname
  21254. ====================
  21255.  
  21256. Syntax
  21257. ------
  21258.  
  21259.      #include <fcntl.h>
  21260.      
  21261.      char * _lfn_gen_short_fname (const char *long_fname, char *short_fname);
  21262.  
  21263. Description
  21264. -----------
  21265.  
  21266. This function generates a short (8+3) filename alias for the long
  21267. filename pointed to by LONG_FNAME and puts it into the buffer pointed
  21268. to by SHORT_FNAME.  It uses the same algorithm that Windows 9x uses,
  21269. with the exception that the returned short name will never have a
  21270. numeric tail, because this function doesn't check the directory to see
  21271. whether the generated short name will collide with any other file in
  21272. the directory.  Note that LONG_FNAME must contain only the name part of
  21273. a file; elements of a full pathname (like `:' or `/' are not allowed
  21274. (they will cause the function to fail).  SHORT_FNAME will be returned
  21275. upper-cased, since that is how 8+3 filenames are stored in directory
  21276. entries.
  21277.  
  21278. When the LFN API is not supported (*note _use_lfn::.), the function
  21279. simply converts up to 12 characters of LONG_FNAME to upper-case and
  21280. returns that.  It will do the same if LONG_FNAME includes any
  21281. characters illegal in a filename.
  21282.  
  21283. You might need to call this function if you want to know whether a given
  21284. filename is valid on MSDOS: if a case-sensitive string comparison
  21285. function such as `strcmp' (*note strcmp::.) returns a 0 when it
  21286. compares the original long filename with the short one returned by
  21287. `_lfn_gen_short_fname', then the filename is a valid DOS name.  (Note
  21288. that if LONG_FNAME is in lower case, it might not compare equal with
  21289. SHORT_FNAME because of the case difference.)
  21290.  
  21291. Return value
  21292. ------------
  21293.  
  21294. The function returns a pointer to SHORT_FNAME.
  21295.  
  21296. Portability
  21297. -----------
  21298.  
  21299. not ANSI, not POSIX
  21300.  
  21301. Example
  21302. -------
  21303.  
  21304.      #include <stdio.h>
  21305.      #include <string.h>
  21306.      #include <fcntl.h>
  21307.      
  21308.      int dos_check (char *fname)
  21309.      {
  21310.        char fshort[13];
  21311.        int retval;
  21312.      
  21313.        if (stricmp (_lfn_gen_short_fname (fname, fshort), fname) == 0)
  21314.        {
  21315.          printf ("%s is a valid MSDOS 8+3 filename\n", fname);
  21316.          retval = 1;
  21317.        }
  21318.        else
  21319.        {
  21320.          printf ("%s will have to be changed for MSDOS\n", fname);
  21321.          retval = 0;
  21322.        }
  21323.        return retval;
  21324.      }
  21325.  
  21326. 
  21327. File: libc.info,  Node: _lfn_get_ftime,  Next: __libc_termios_init,  Prev: _lfn_gen_short_fname,  Up: Alphabetical List
  21328.  
  21329. _lfn_get_ftime
  21330. ==============
  21331.  
  21332. Syntax
  21333. ------
  21334.  
  21335.      #include <fcntl.h>
  21336.      
  21337.      char _lfn_get_ftime (int fhandle, int flag);
  21338.  
  21339. Description
  21340. -----------
  21341.  
  21342. This function returns creation and access time for files that reside on
  21343. a filesystem which supports long filenames (such as Windows 95).  Files
  21344. which reside on native FAT filesystems will cause this function to fail.
  21345. The FHANDLE parameter is the file handle as returned by one of the
  21346. functions which open or create files.  The FLAG parameter determines
  21347. which time (creation or access) is returned.  It can be set to one of
  21348. the following:
  21349.  
  21350. `_LFN_ATIME'
  21351.      Causes `_lfn_get_ftime' to return the time when the file was last
  21352.      accessed.  (Currently, it actually only returns the *date* of last
  21353.      access; the time bits are all zeroed.)
  21354.  
  21355. `_LFN_CTIME'
  21356.      Causes `_lfn_get_ftime' to return the time when the file was
  21357.      created.  Note that if the file was created by a program which
  21358.      doesn't support long filenames, this time will be zero.
  21359.  
  21360. Return value
  21361. ------------
  21362.  
  21363. The file time stamp, as a packed unsigned int value:
  21364.  
  21365. `Bits 0-4'
  21366.      seconds divided by 2
  21367.  
  21368. `Bits 5-10'
  21369.      minutes (0-59)
  21370.  
  21371. `Bits 11-15'
  21372.      hours (0-23)
  21373.  
  21374. `Bits 16-20'
  21375.      day of the month (1-31)
  21376.  
  21377. `Bits 21-24'
  21378.      month (1 = January)
  21379.  
  21380. `Bits 25-31'
  21381.      year offset from 1980 (add 1980 to get the actual year)
  21382.  
  21383. If the underlying system calls fail, the function will return 0 and set
  21384. `errno' to an appropriate value.
  21385.  
  21386. Portability
  21387. -----------
  21388.  
  21389. not ANSI, not POSIX
  21390.  
  21391. Example
  21392. -------
  21393.  
  21394.       unsigned file_stamp = _lfn_get_ftime (handle, _LFN_CTIME);
  21395.  
  21396. 
  21397. File: libc.info,  Node: __libc_termios_init,  Next: libm,  Prev: _lfn_get_ftime,  Up: Alphabetical List
  21398.  
  21399. __libc_termios_init
  21400. ===================
  21401.  
  21402. Syntax
  21403. ------
  21404.  
  21405.      #include <libc/ttyprvt.h>
  21406.      
  21407.      void __libc_termios_init (void);
  21408.  
  21409. Description
  21410. -----------
  21411.  
  21412. This function sets read/write hooks for the termios emulation and
  21413. import parameters. Currently importing parameters is not supported, the
  21414. emulation is resolved by only internal(static) parameters.  Note that
  21415. this function is called by tcXXX function automatically.
  21416.  
  21417. Portability
  21418. -----------
  21419.  
  21420. not ANSI, not POSIX
  21421.  
  21422. 
  21423. File: libc.info,  Node: libm,  Next: link,  Prev: __libc_termios_init,  Up: Alphabetical List
  21424.  
  21425. libm
  21426. ====
  21427.  
  21428. Syntax
  21429. ------
  21430.  
  21431.      #include <libm/math.h>
  21432.      
  21433.      enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
  21434.      
  21435.      #define _LIB_VERSION_TYPE enum fdversion
  21436.      #define _LIB_VERSION _fdlib_version
  21437.      
  21438.      extern  _LIB_VERSION_TYPE  _LIB_VERSION;
  21439.      
  21440.      #define _IEEE_  fdlibm_ieee
  21441.      #define _SVID_  fdlibm_svid
  21442.      #define _XOPEN_ fdlibm_xopen
  21443.      #define _POSIX_ fdlibm_posix
  21444.      
  21445.      _LIB_VERSION_TYPE _LIB_VERSION = _IEEE_;
  21446.  
  21447. Description
  21448. -----------
  21449.  
  21450. The alternate math library, `libm.a', originally written by "Cygnus
  21451. support", provides versions of mathematical functions which comply to
  21452. several different standards of behavior in abnormal cases, and are
  21453. sometimes more accurate than those included in the default `libc.a'
  21454. library, in particular when elaborate argument reduction is required to
  21455. avoid precision loss.  Functions in `libm.a' allow to create programs
  21456. with well-defined and standard-compliant behavior when numerical errors
  21457. occur, and provide the application with a means to control their
  21458. behavior in abnormal cases via the `matherr' callback.  They almost
  21459. never rely on the features specific to the x87 FPU, and are thus slower
  21460. and sometimes slightly less accurate than the functions from `libc.a'.
  21461.  
  21462. In contrast, the functions in the default `libc.a' library are written
  21463. for maximum speed and exploitation of the x87 FPU features, do not call
  21464. `matherr', and are therefore much faster and sometimes more accurate
  21465. (due to the extended 80-bit precision with which the x87 FPU carries
  21466. its calculations).
  21467.  
  21468. Another aspect of differences between functions in `libc.a' and in
  21469. `libm.a' is the value returned when the result overflows a `double'.
  21470. The functions from `libc.a' always return a suitably signed infinity,
  21471. `Inf', whereas for functions from `libm.a' an application can arrange
  21472. for a large but finite value to be returned.  Getting finite return
  21473. values might be important in certain kinds of mathematical computations
  21474. where the special rules defined for infinities (e.g., Inf + a = Inf)
  21475. might be inappropriate.
  21476.  
  21477. Refer to *Note description of the `libm.a' functions: (libm)Math, for
  21478. detailed documentation of the individual functions from `libm.a'.  This
  21479. section explains the general setup of using those functions from DJGPP
  21480. programs.
  21481.  
  21482. To use the alternate math library with your program, you need to do the
  21483. following:
  21484.  
  21485.    * Include the header `<libm/math.h>'.  Alternatively, you can include
  21486.      `<math.h>' as usual and compile with `-D_USE_LIBM_MATH_H' option
  21487.      to `gcc', which will cause it to use `libm/math.h' instead of the
  21488.      default `math.h'.  (The second possibility leaves the source
  21489.      ANSI-compliant.)
  21490.  
  21491.    * Set the global variable `_fdlib_version' to a value other than the
  21492.      default `_IEEE_'.  The possible values are listed and explained
  21493.      below.
  21494.  
  21495.    * At the beginning of your `main' function, set the FPU to a
  21496.      predictable state by calling `_clear87' (*note _clear87::.) and
  21497.      `_fpreset' (*note _fpreset::.) library functions.  (Another
  21498.      possibility is to make these calls in a function declared with
  21499.      `__attribute__((constructor))', so it will be called before
  21500.      `main'.)
  21501.  
  21502.    * Link your program with the `libm.a' library, e.g. by specifying
  21503.      `-lm' on the link command line.
  21504.  
  21505. The functions in `libm.a' can emulate different standards.  You can
  21506. select to which standard your program will comply by setting the global
  21507. variable `_fdlib_version' (or the macro `_LIB_VERSION' which evaluates
  21508. to it) to one of the values below.  This will only affect the behavior
  21509. of the math functions when an error is signaled by the FPU.
  21510.  
  21511. `_IEEE_'
  21512.      The default value, specifies IEEE-compliant operation.  In case of
  21513.      an error, this version will immediately return whatever result is
  21514.      computed by the FPU, and will *not* set `errno'.  If the result
  21515.      overflows, an `Inf' is returned.  This version gives the fastest
  21516.      code.
  21517.  
  21518. `_POSIX_'
  21519.      In case of an error, this version will set `errno' to the
  21520.      appropriate value (`EDOM' or `ERANGE') and return to the caller,
  21521.      without calling the `matherr' function (*note matherr::.).  If the
  21522.      result overflows, an `Inf' is returned.  This version should be
  21523.      used for maximum POSIX- and ANSI-compliance.
  21524.  
  21525. `_SVID_'
  21526.      This version is compliant with the "System V Interface Definition".
  21527.      This is the slowest version.  In case of an error, it calls the
  21528.      `matherr' function (*note matherr::.), which can be customized to
  21529.      the specific application needs.  If `matherr' returns zero, a
  21530.      message is printed to the standard error stream which states the
  21531.      name of the function that generated the error and the error type,
  21532.      and `errno' is set.  If `matherr' returns non-zero, there will be
  21533.      no message and `errno' will be left unaltered.  If the result
  21534.      overflows, this version returns `HUGE', a large but finite value
  21535.      defined by `libm/math.h'.
  21536.  
  21537. `_XOPEN_'
  21538.      Complies to the X/Open specifications.  It behaves exactly like
  21539.      `_SVID_', but it never prints an error message, even if `matherr'
  21540.      returns zero, and `Inf' us returned when a result overflows.
  21541.  
  21542. Portability
  21543. -----------
  21544.  
  21545. not ANSI, not POSIX
  21546.  
  21547. Example
  21548. -------
  21549.  
  21550.  
  21551.      /*  Testing errno == EDOM after sqrt(-1).
  21552.      
  21553.          !!!  MUST compile with -lm  !!!  */
  21554.      
  21555.      #include <assert.h>
  21556.      #include <errno.h>
  21557.      #include <stdio.h>
  21558.      #include <libm/math.h>    /* or #define _USE_LIBM_MATH_H and #include <math.h> */
  21559.      #include <float.h>
  21560.      
  21561.      /* Setting _LIB_VERSION to anything but _IEEE_ will turn on errno handling. */
  21562.      _LIB_VERSION_TYPE _LIB_VERSION = _POSIX_;
  21563.      
  21564.      int main (void)
  21565.      {
  21566.        /* Reset the FPU (possible previous FP problems).  */
  21567.        _clear87 ();
  21568.        _fpreset ();
  21569.      
  21570.        /* Run the test.  */
  21571.        errno = 0;
  21572.        assert(errno == 0);
  21573.        sqrt(-1.0);
  21574.        assert(errno == EDOM); /* this line should NOT cause the assertion to fail */
  21575.      
  21576.        return(0);
  21577.      }
  21578.  
  21579. 
  21580. File: libc.info,  Node: link,  Next: llabs,  Prev: libm,  Up: Alphabetical List
  21581.  
  21582. link
  21583. ====
  21584.  
  21585. Syntax
  21586. ------
  21587.  
  21588.      #include <unistd.h>
  21589.      
  21590.      int link(const char *exists, const char *new);
  21591.  
  21592. Description
  21593. -----------
  21594.  
  21595. Because of limitations of MS-DOS, this function doesn't really link two
  21596. files together.  However, it simulates a real `link' by copying the
  21597. file at EXISTS to NEW.
  21598.  
  21599. Return Value
  21600. ------------
  21601.  
  21602. Zero on success, nonzero on failure.
  21603.  
  21604. Portability
  21605. -----------
  21606.  
  21607. not ANSI, POSIX
  21608.  
  21609. Example
  21610. -------
  21611.  
  21612.      link("foo.c", "foo.bak");
  21613.  
  21614. 
  21615. File: libc.info,  Node: llabs,  Next: lldiv,  Prev: link,  Up: Alphabetical List
  21616.  
  21617. llabs
  21618. =====
  21619.  
  21620. Syntax
  21621. ------
  21622.  
  21623.      #include <stdlib.h>
  21624.      
  21625.      long long llabs(long long x);
  21626.  
  21627. Description
  21628. -----------
  21629.  
  21630. This function takes the absolute value of X.  *Note abs::.
  21631.  
  21632. Return Value
  21633. ------------
  21634.  
  21635. |X|
  21636.  
  21637. Portability
  21638. -----------
  21639.  
  21640. not ANSI, not POSIX
  21641.  
  21642. 
  21643. File: libc.info,  Node: lldiv,  Next: load_npx,  Prev: llabs,  Up: Alphabetical List
  21644.  
  21645. lldiv
  21646. =====
  21647.  
  21648. Syntax
  21649. ------
  21650.  
  21651.      #include <stdlib.h>
  21652.      
  21653.      lldiv_t lldiv(long long numerator, long long denominator);
  21654.  
  21655. Description
  21656. -----------
  21657.  
  21658. Returns the quotient and remainder of the division NUMERATOR divided by
  21659. DENOMINATOR.  The return type is as follows:
  21660.  
  21661.      typedef struct {
  21662.        long long quot;
  21663.        long long rem;
  21664.      } lldiv_t;
  21665.  
  21666. Return Value
  21667. ------------
  21668.  
  21669. The results of the division are returned.
  21670.  
  21671. Portability
  21672. -----------
  21673.  
  21674. not ANSI, not POSIX
  21675.  
  21676. Example
  21677. -------
  21678.  
  21679.      lldiv_t l = lldiv(42, 3);
  21680.      printf("42 = %lld x 3 + %lld\n", l.quot, l.rem);
  21681.      
  21682.      lldiv(+40, +3) = { +13, +1 }
  21683.      lldiv(+40, -3) = { -13, -1 }
  21684.      lldiv(-40, +3) = { -13, -1 }
  21685.      lldiv(-40, -3) = { +13, -1 }
  21686.  
  21687. 
  21688. File: libc.info,  Node: load_npx,  Next: localeconv,  Prev: lldiv,  Up: Alphabetical List
  21689.  
  21690. load_npx
  21691. ========
  21692.  
  21693. Syntax
  21694. ------
  21695.  
  21696.      #include <debug/dbgcom.h>
  21697.      
  21698.      extern NPX npx;
  21699.      void load_npx (void);
  21700.  
  21701. Description
  21702. -----------
  21703.  
  21704. This function restores the state of the x87 numeric processor from the
  21705. data saved in the external variable `npx'.  This variable is a
  21706. structure defined as follows in the header `debug/dbgcom.h':
  21707.  
  21708.      typedef struct {
  21709.        unsigned short sig0;
  21710.        unsigned short sig1;
  21711.        unsigned short sig2;
  21712.        unsigned short sig3;
  21713.        unsigned short exponent:15;
  21714.        unsigned short sign:1;
  21715.      } NPXREG;
  21716.      
  21717.      typedef struct {
  21718.        unsigned long control;
  21719.        unsigned long status;
  21720.        unsigned long tag;
  21721.        unsigned long eip;
  21722.        unsigned long cs;
  21723.        unsigned long dataptr;
  21724.        unsigned long datasel;
  21725.        NPXREG reg[8];
  21726.        long double st[8];
  21727.        char st_valid[8];
  21728.        long double mmx[8];
  21729.        char in_mmx_mode;
  21730.        char top;
  21731.      } NPX;
  21732.  
  21733. `load_npx' should be called immediately after `run_child' (*note
  21734. run_child::.) is called to begin or resume the debugged program, and
  21735. provided that a call to `save_npx' was issued before `run_child' was
  21736. called.  *Note save_npx::.
  21737.  
  21738. Portability
  21739. -----------
  21740.  
  21741. not ANSI, not POSIX
  21742.  
  21743. Example
  21744. -------
  21745.  
  21746.       save_npx ();
  21747.       run_child ();
  21748.       load_npx ();
  21749.  
  21750. 
  21751. File: libc.info,  Node: localeconv,  Next: localtime,  Prev: load_npx,  Up: Alphabetical List
  21752.  
  21753. localeconv
  21754. ==========
  21755.  
  21756. Syntax
  21757. ------
  21758.  
  21759.      #include <locale.h>
  21760.      
  21761.      struct lconv *localeconv(void);
  21762.  
  21763. Description
  21764. -----------
  21765.  
  21766. This function returns a pointer to a static structure that contains
  21767. information about the current locale.  The structure contains these
  21768. fields:
  21769.  
  21770. `char *currency_symbol'
  21771.      A string that should be used when printing local currency.
  21772.  
  21773. `char *decimal_point'
  21774.      A string that is used to separate the integer and fractional
  21775.      portions of real numbers in `printf'.  Currently, only the first
  21776.      character is significant.
  21777.  
  21778. `char *grouping'
  21779.      An array of numbers indicating the size of groupings for
  21780.      non-monetary values to the left of the decimal point.  The first
  21781.      number is the size of the grouping just before the decimal point.
  21782.      A number of zero means to repeat the previous number indefinitely.
  21783.      A number of `CHAR_MAX' means to group the remainder of the digits
  21784.      together.
  21785.  
  21786. `char *int_curr_symbol'
  21787.      A string that should be used when formatting monetary values for
  21788.      local currency when the result will be used internationally.
  21789.  
  21790. `char *mon_decimal_point'
  21791.      A string that separates the interger and fractional parts of
  21792.      monetary values.
  21793.  
  21794. `char *mon_grouping'
  21795.      Same as grouping, but for monetary values.
  21796.  
  21797. `char *negative_sign'
  21798.      A string that is used to represent negative monetary values.
  21799.  
  21800. `char *positive_sign'
  21801.      A string that is used to represent positive monetary values.
  21802.  
  21803. `char *thousands_sep'
  21804.      The grouping separator for non-monetary values.
  21805.  
  21806. `char frac_digits'
  21807.      The number of digits to the right of the decimal point for monetary
  21808.      values.
  21809.  
  21810. `char int_frac_digits'
  21811.      Like frac_digits, but when formatting for international use.
  21812.  
  21813. `char n_cs_precedes'
  21814.      If nonzero, the currency string should precede the monetary value
  21815.      if the monetary value is negative.
  21816.  
  21817. `char n_sep_by_space'
  21818.      If nonzero, the currency string and the monetary value should be
  21819.      separated by a space if the monetary value is negative.
  21820.  
  21821. `char n_sign_posn'
  21822.      Determines the placement of the negative indication string if the
  21823.      monetary value is negative.
  21824.  
  21825.     0
  21826.           ($value), (value$)
  21827.  
  21828.     1
  21829.           -$value, -value$
  21830.  
  21831.     2
  21832.           $value-, value$-
  21833.  
  21834.     3
  21835.           -$value, value-$
  21836.  
  21837.     4
  21838.           $-value, value$-
  21839.  
  21840. `char p_cs_precedes'
  21841.  
  21842. `char p_sep_by_space'
  21843.  
  21844. `char p_sign_posn'
  21845.      These are the same as n_*, but for when the monetary value is
  21846.      positive.
  21847.  
  21848. Note that any numeric field may have a value of `CHAR_MAX', which
  21849. indicates that no information is available.
  21850.  
  21851. Return Value
  21852. ------------
  21853.  
  21854. A pointer to the `struct lconv' structure.
  21855.  
  21856. Portability
  21857. -----------
  21858.  
  21859. ANSI, POSIX
  21860.  
  21861. Example
  21862. -------
  21863.  
  21864.      struct lconv *l = localeconv;
  21865.      printf("%s%d\n", l->negative_sign, value);
  21866.  
  21867. 
  21868. File: libc.info,  Node: localtime,  Next: lock,  Prev: localeconv,  Up: Alphabetical List
  21869.  
  21870. localtime
  21871. =========
  21872.  
  21873. Syntax
  21874. ------
  21875.  
  21876.      #include <time.h>
  21877.      
  21878.      struct tm *localtime(const time_t *tod);
  21879.  
  21880. Description
  21881. -----------
  21882.  
  21883. Converts the time represented by TOD into a structure, correcting for
  21884. the local timezone.  See *Note gmtime::, for the description of `struct
  21885. tm'.
  21886.  
  21887. Return Value
  21888. ------------
  21889.  
  21890. A pointer to a static structure which is overwritten with each call.
  21891.  
  21892. Portability
  21893. -----------
  21894.  
  21895. ANSI, POSIX
  21896.  
  21897. 
  21898. File: libc.info,  Node: lock,  Next: log,  Prev: localtime,  Up: Alphabetical List
  21899.  
  21900. lock
  21901. ====
  21902.  
  21903. Syntax
  21904. ------
  21905.  
  21906.      #include <io.h>
  21907.      
  21908.      int lock(int fd, long offset, long length);
  21909.  
  21910. Description
  21911. -----------
  21912.  
  21913. Locks a region in file FD using MS-DOS file sharing interface.  The
  21914. region of LENGTH bytes, starting from OFFSET, will become entirely
  21915. inaccessible to other processes. If multiple locks are used on a single
  21916. file they must be non-overlapping. The lock must be removed before the
  21917. file is closed.
  21918.  
  21919. This function will fail unless SHARE, or a network software providing
  21920. similar interface, is installed. This function is compatible with
  21921. Borland C++ function of the same name.
  21922.  
  21923. *Note unlock::.
  21924.  
  21925. Return Value
  21926. ------------
  21927.  
  21928. Zero if successful, nonzero if not.
  21929.  
  21930. Portability
  21931. -----------
  21932.  
  21933. not ANSI, not POSIX
  21934.  
  21935. 
  21936. File: libc.info,  Node: log,  Next: log10,  Prev: lock,  Up: Alphabetical List
  21937.  
  21938. log
  21939. ===
  21940.  
  21941. Syntax
  21942. ------
  21943.  
  21944.      #include <math.h>
  21945.      
  21946.      double log(double x);
  21947.  
  21948. Description
  21949. -----------
  21950.  
  21951. This function computes the natural logarithm of X.
  21952.  
  21953. Return Value
  21954. ------------
  21955.  
  21956. The natural logarithm of X.  If X is zero, a negative infinity is
  21957. returned and `errno' is set to `ERANGE'.  If X is negative or `+Inf' or
  21958. a `NaN', the return value is `NaN' and `errno' is set to `EDOM'.
  21959.  
  21960. Portability
  21961. -----------
  21962.  
  21963. ANSI, POSIX
  21964.  
  21965. 
  21966. File: libc.info,  Node: log10,  Next: log1p,  Prev: log,  Up: Alphabetical List
  21967.  
  21968. log10
  21969. =====
  21970.  
  21971. Syntax
  21972. ------
  21973.  
  21974.      #include <math.h>
  21975.      
  21976.      double log10(double x);
  21977.  
  21978. Description
  21979. -----------
  21980.  
  21981. This function computes the base-10 logarithm of X.
  21982.  
  21983. Return Value
  21984. ------------
  21985.  
  21986. The logarithm base 10 of X.  If X is zero, a negative infinity is
  21987. returned and `errno' is set to `ERANGE'.  If X is negative or `+Inf' or
  21988. a `NaN', the return value is `NaN' and `errno' is set to `EDOM'.
  21989.  
  21990. Portability
  21991. -----------
  21992.  
  21993. ANSI, POSIX
  21994.  
  21995. 
  21996. File: libc.info,  Node: log1p,  Next: log2,  Prev: log10,  Up: Alphabetical List
  21997.  
  21998. log1p
  21999. =====
  22000.  
  22001. Syntax
  22002. ------
  22003.  
  22004.      #include <math.h>
  22005.      
  22006.      double log1p(double x);
  22007.  
  22008. Description
  22009. -----------
  22010.  
  22011. This function computes the natural logarithm of 1 + X.  It is more
  22012. accurate than `log(1 + X)' for small values of X.
  22013.  
  22014. Return Value
  22015. ------------
  22016.  
  22017. The natural logarithm of 1 + X.  If X is -1, a negative infinity is
  22018. returned and `errno' is set to `ERANGE'.  If X is less than -1 or
  22019. `+Inf' or a `NaN', the return value is `NaN' and `errno' is set to
  22020. `EDOM'.
  22021.  
  22022. Portability
  22023. -----------
  22024.  
  22025. not ANSI, not POSIX
  22026.  
  22027. 
  22028. File: libc.info,  Node: log2,  Next: longjmp,  Prev: log1p,  Up: Alphabetical List
  22029.  
  22030. log2
  22031. ====
  22032.  
  22033. Syntax
  22034. ------
  22035.  
  22036.      #include <math.h>
  22037.      
  22038.      double log2(double x);
  22039.  
  22040. Description
  22041. -----------
  22042.  
  22043. This function computes the base-2 logarithm of X.
  22044.  
  22045. Return Value
  22046. ------------
  22047.  
  22048. The base-2 logarithm of X.  If X is zero, a negative infinity is
  22049. returned and `errno' is set to `ERANGE'.  If X is negative or `+Inf' or
  22050. a `NaN', the return value is `NaN' and `errno' is set to `EDOM'.
  22051.  
  22052. Portability
  22053. -----------
  22054.  
  22055. not ANSI, not POSIX
  22056.  
  22057. 
  22058. File: libc.info,  Node: longjmp,  Next: lowvideo,  Prev: log2,  Up: Alphabetical List
  22059.  
  22060. longjmp
  22061. =======
  22062.  
  22063. Syntax
  22064. ------
  22065.  
  22066.      #include <setjmp.h>
  22067.      
  22068.      void longjmp(jmp_buf env, int val);
  22069.  
  22070. Description
  22071. -----------
  22072.  
  22073. This function reverts back to a CPU state that was stored in ENV by
  22074. `setjmp' (*note setjmp::.).  The state includes all CPU registers, so
  22075. any variable in a register when `setjmp' was called will be preserved,
  22076. and all else will be indeterminate.
  22077.  
  22078. The value passed as VAL will be the return value of `setjmp' when it
  22079. resumes processing there.  If VAL is zero, the return value will be one.
  22080.  
  22081. Return Value
  22082. ------------
  22083.  
  22084. This function does not return.
  22085.  
  22086. Portability
  22087. -----------
  22088.  
  22089. ANSI, POSIX
  22090.  
  22091. Example
  22092. -------
  22093.  
  22094.      jmp_buf j;
  22095.      if (setjmp(j))
  22096.        return;
  22097.      do_something();
  22098.      longjmp(j, 1);
  22099.  
  22100. 
  22101. File: libc.info,  Node: lowvideo,  Next: lseek,  Prev: longjmp,  Up: Alphabetical List
  22102.  
  22103. lowvideo
  22104. ========
  22105.  
  22106. Syntax
  22107. ------
  22108.  
  22109.      #include <conio.h>
  22110.      
  22111.      void    lowvideo(void);
  22112.  
  22113. Description
  22114. -----------
  22115.  
  22116. Causes any new characters put on the screen to be dim.
  22117.  
  22118. Portability
  22119. -----------
  22120.  
  22121. not ANSI, not POSIX
  22122.  
  22123. 
  22124. File: libc.info,  Node: lseek,  Next: malloc,  Prev: lowvideo,  Up: Alphabetical List
  22125.  
  22126. lseek
  22127. =====
  22128.  
  22129. Syntax
  22130. ------
  22131.  
  22132.      #include <unistd.h>
  22133.      
  22134.      off_t lseek(int fd, off_t offset, int whence);
  22135.  
  22136. Description
  22137. -----------
  22138.  
  22139. This function moves the file pointer for handle FD according to WHENCE:
  22140.  
  22141. `SEEK_SET'
  22142.      The file pointer is moved to the OFFSET specified.
  22143.  
  22144. `SEEK_CUR'
  22145.      The file pointer is moved OFFSET bytes relative to its current
  22146.      position.
  22147.  
  22148. `SEEK_END'
  22149.      The file pointer is moved to a position OFFSET bytes from the end
  22150.      of the file.  The value of OFFSET is usually nonpositive in this
  22151.      case.
  22152.  
  22153. Return Value
  22154. ------------
  22155.  
  22156. The new offset is returned.
  22157.  
  22158. Portability
  22159. -----------
  22160.  
  22161. not ANSI, POSIX
  22162.  
  22163. Example
  22164. -------
  22165.  
  22166.      lseek(fd, 12, SEEK_CUR); /* skip 12 bytes */
  22167.  
  22168. 
  22169. File: libc.info,  Node: malloc,  Next: matherr,  Prev: lseek,  Up: Alphabetical List
  22170.  
  22171. malloc
  22172. ======
  22173.  
  22174. Syntax
  22175. ------
  22176.  
  22177.      #include <stdlib.h>
  22178.      
  22179.      void *malloc(size_t size);
  22180.  
  22181. Description
  22182. -----------
  22183.  
  22184. This function allocates a chunk of memory from the heap large enough to
  22185. hold any object that is SIZE bytes in length.  This memory must be
  22186. returned to the heap with `free' (*note free::.).
  22187.  
  22188. Note: this version of malloc is designed to reduce memory usage.  A
  22189. faster but less efficient version is available in the libc sources
  22190. (djlsr*.zip) in src/libc/ansi/stdlib/fmalloc.c
  22191.  
  22192. Return Value
  22193. ------------
  22194.  
  22195. A pointer to the allocated memory, or `NULL' if there isn't enough free
  22196. memory to satisfy the request.
  22197.  
  22198. Portability
  22199. -----------
  22200.  
  22201. ANSI, POSIX
  22202.  
  22203. Example
  22204. -------
  22205.  
  22206.      char *c = (char *)malloc(100);
  22207.  
  22208. 
  22209. File: libc.info,  Node: matherr,  Next: mblen,  Prev: malloc,  Up: Alphabetical List
  22210.  
  22211. matherr
  22212. =======
  22213.  
  22214. Syntax
  22215. ------
  22216.  
  22217.      #include <libm/math.h>
  22218.      
  22219.      enum fdversion _fdlib_version = _SVID_;
  22220.      
  22221.      int matherr(struct exception *exc);
  22222.  
  22223. Description
  22224. -----------
  22225.  
  22226. `matherr' is a user-definable handler for errors in math library
  22227. functions.  It is only supported in the alternate math library (link
  22228. with `-lm'), and will only be called if the global variable
  22229. `_fdlib_version' is set to either `_SVID_' or `_XOPEN_' (*note
  22230. libm::.).  You also need to mask the Invalid Operation exception in the
  22231. x87 control word (*note _control87::.) or install a handler for signal
  22232. `SIGFPE' (*note signal::.), or else some exceptions will generate
  22233. `SIGFPE' and your program will be terminated before it gets a chance to
  22234. call `matherr'.  DJGPP versions 2.02 and later mask all FP exceptions
  22235. at startup, so this consideration applies only to programs that unmask
  22236. FP exceptions at run time.
  22237.  
  22238. If the above conditions are met, every math function will call
  22239. `matherr' when a numerical exception is detected.  The default version
  22240. of `matherr', supplied with `libm.a', does nothing and returns zero
  22241. (the `_SVID_' version will then print an error message to the standard
  22242. error stream and set `errno').
  22243.  
  22244. This default behavior is inappropriate in some cases.  For example, an
  22245. interactive program which runs in a windowed environment might want the
  22246. error message to go to a particular window, or pop up a dialog box; a
  22247. fault-tolerant program might want to fall back to backup procedures so
  22248. that meaningful results are returned to the application code, etc.  In
  22249. such cases, you should include your own version of `matherr' in your
  22250. program.
  22251.  
  22252. `matherr' is called with a single argument EXC which is a pointer to a
  22253. structure defined on `<libm/math.h>' like this:
  22254.  
  22255.      struct exception {
  22256.          int type;
  22257.          char *name;
  22258.          double arg1, arg2, retval;
  22259.      };
  22260.  
  22261. The member `type' is an integer code describing the type of exception
  22262. that has occured.  It can be one of the following:
  22263.  
  22264. `DOMAIN'
  22265.      Argument(s) are outside the valid function domain (e.g.,
  22266.      `log(-1)').
  22267.  
  22268. `SING'
  22269.      Argument(s) would result in a singularity (e.g., `log(0)').
  22270.  
  22271. `OVERFLOW'
  22272.      The result causes overflow, like in `exp(10000)'.
  22273.  
  22274. `UNDERFLOW'
  22275.      The result causes underflow, like in `exp(-10000)'.
  22276.  
  22277. `TLOSS'
  22278.      The result loses all significant digits, like in `sin(10e100)'.
  22279.  
  22280. These codes are defined on `<libm/math.h>'.
  22281.  
  22282. The member `name' points to the string that is the name of the function
  22283. which generated the exception.  The members `arg1' and `arg2' are the
  22284. values of the arguments with which the function was called (`arg2' is
  22285. undefined if the function only accepts a single argument).  The member
  22286. `retval' is set to the default value that will be returned by the math
  22287. library function; `matherr' can change it to return a different value.
  22288.  
  22289. Return Value
  22290. ------------
  22291.  
  22292. `matherr' should return zero if it couldn't handle the exception, or
  22293. non-zero if the exception was handled.
  22294.  
  22295. If `matherr' returns zero, under `_SVID_' version an error message is
  22296. printed which includes the name of the function and the exception type,
  22297. and under `_SVID_' and `_XOPEN_' `errno' is set to an appropriate
  22298. value.  If `matherr' returns non-zero, no error message is printed and
  22299. `errno' is left unchanged.
  22300.  
  22301. Portability
  22302. -----------
  22303.  
  22304. not ANSI, not POSIX
  22305.  
  22306. Example
  22307. -------
  22308.  
  22309.        #include <libm/math.h>
  22310.      
  22311.        int matherr(register struct exception *x)
  22312.        {
  22313.          switch (x->type) {
  22314.            case DOMAIN:
  22315.              /* change sqrt to return sqrt(-arg1), not NaN */
  22316.              if (!strcmp(x->name, "sqrt")) {
  22317.                x->retval = sqrt(-x->arg1);
  22318.                return 1; /* be silent: no message, don't set errno */
  22319.              } /* FALL THROUGH */
  22320.            case SING:
  22321.              /* all other domain or sing exceptions, print message and abort */
  22322.              fprintf(stderr, "domain exception in %s\n", x->name);
  22323.              abort();
  22324.              break;
  22325.          }
  22326.          return 0; /* all other exceptions, execute default procedure */
  22327.        }
  22328.  
  22329. 
  22330. File: libc.info,  Node: mblen,  Next: mbstowcs,  Prev: matherr,  Up: Alphabetical List
  22331.  
  22332. mblen
  22333. =====
  22334.  
  22335. Syntax
  22336. ------
  22337.  
  22338.      #include <stdlib.h>
  22339.      
  22340.      int mblen(const char *s, size_t n);
  22341.  
  22342. Description
  22343. -----------
  22344.  
  22345. This function returns the number of characters of string S that make up
  22346. the next multibyte character.  No more than N characters are checked.
  22347.  
  22348. If S is `NULL', the internal shift state is reset.
  22349.  
  22350. Return Value
  22351. ------------
  22352.  
  22353. The number of characters that comprise the next multibyte character.
  22354.  
  22355. Portability
  22356. -----------
  22357.  
  22358. ANSI, POSIX
  22359.  
  22360. Example
  22361. -------
  22362.  
  22363.      int n = mblen(string, INT_MAX);
  22364.      string += n;
  22365.  
  22366. 
  22367. File: libc.info,  Node: mbstowcs,  Next: mbtowc,  Prev: mblen,  Up: Alphabetical List
  22368.  
  22369. mbstowcs
  22370. ========
  22371.  
  22372. Syntax
  22373. ------
  22374.  
  22375.      #include <stdlib.h>
  22376.      
  22377.      size_t mbstowcs(wchar_t *wcs, const char *s, size_t n);
  22378.  
  22379. Description
  22380. -----------
  22381.  
  22382. Converts a multibyte string to a wide character string.  The result
  22383. will be no more than N wide characters.
  22384.  
  22385. Return Value
  22386. ------------
  22387.  
  22388. The number of wide characters stored.
  22389.  
  22390. Portability
  22391. -----------
  22392.  
  22393. ANSI, POSIX
  22394.  
  22395. Example
  22396. -------
  22397.  
  22398.      int wlen = mbtowcs(wbuf, string, sizeof(wbuf)/sizeof(wchar_t));
  22399.  
  22400. 
  22401. File: libc.info,  Node: mbtowc,  Next: memccpy,  Prev: mbstowcs,  Up: Alphabetical List
  22402.  
  22403. mbtowc
  22404. ======
  22405.  
  22406. Syntax
  22407. ------
  22408.  
  22409.      #include <stdlib.h>
  22410.      
  22411.      int mbtowc(wchar_t *pwc, const char *s, size_t n);
  22412.  
  22413. Description
  22414. -----------
  22415.  
  22416. Convert the first multibyte sequence in S to a wide character.  At most
  22417. N characters are checked.  If PWC is not `NULL', the result is stored
  22418. there.  If S is null, the internal shift state is reset.
  22419.  
  22420. Return Value
  22421. ------------
  22422.  
  22423. The number of characters used by the multibyte sequence.
  22424.  
  22425. Portability
  22426. -----------
  22427.  
  22428. ANSI, POSIX
  22429.  
  22430. Example
  22431. -------
  22432.  
  22433.      string += mbtowc(&wc, string, strlen(string));
  22434.  
  22435. 
  22436. File: libc.info,  Node: memccpy,  Next: memchr,  Prev: mbtowc,  Up: Alphabetical List
  22437.  
  22438. memccpy
  22439. =======
  22440.  
  22441. Syntax
  22442. ------
  22443.  
  22444.      #include <string.h>
  22445.      
  22446.      void * memccpy(void *to, const void *from, int ch, size_t nbytes)
  22447.  
  22448. Description
  22449. -----------
  22450.  
  22451. This function copies characters from memory area FROM into TO, stopping
  22452. after the first occurrence of character CH has been copied, or after
  22453. NBYTES characters have been copied, whichever comes first.  The buffers
  22454. should not overlap.
  22455.  
  22456. Return Value
  22457. ------------
  22458.  
  22459. A pointer to the character after the copy of CH in TO, or a `NULL'
  22460. pointer if CH was not found in the first NBYTES characters of FROM.
  22461.  
  22462. Portability
  22463. -----------
  22464.  
  22465. not ANSI, not POSIX
  22466.  
  22467. Example
  22468. -------
  22469.  
  22470.      char inpbuf[256], dest[81];
  22471.      
  22472.      printf("Enter a path: ");
  22473.      fflush(stdout);
  22474.      gets(inpbuf);
  22475.      memset(dest, 0, sizeof(dest));
  22476.      if (memccpy(dest, inpbuf, '\\', 80))
  22477.        printf("The first directory in path is %s\n", dest);
  22478.      else
  22479.        printf("No explicit directory in path\n");
  22480.  
  22481. 
  22482. File: libc.info,  Node: memchr,  Next: memcmp,  Prev: memccpy,  Up: Alphabetical List
  22483.  
  22484. memchr
  22485. ======
  22486.  
  22487. Syntax
  22488. ------
  22489.  
  22490.      #include <string.h>
  22491.      
  22492.      void *memchr(const void *string, int ch, size_t num);
  22493.  
  22494. Description
  22495. -----------
  22496.  
  22497. This function searches NUM bytes starting at STRING, looking for the
  22498. first occurence of CH.
  22499.  
  22500. Return Value
  22501. ------------
  22502.  
  22503. A pointer to the first match, or `NULL' if it wasn't found.
  22504.  
  22505. Portability
  22506. -----------
  22507.  
  22508. ANSI, POSIX
  22509.  
  22510. Example
  22511. -------
  22512.  
  22513.      if (memchr(path, '/', strlen(path))
  22514.        do_slash();
  22515.  
  22516. 
  22517. File: libc.info,  Node: memcmp,  Next: memcpy,  Prev: memchr,  Up: Alphabetical List
  22518.  
  22519. memcmp
  22520. ======
  22521.  
  22522. Syntax
  22523. ------
  22524.  
  22525.      #include <string.h>
  22526.      
  22527.      int memcmp(const void *s1, const void *s2, size_t num);
  22528.  
  22529. Description
  22530. -----------
  22531.  
  22532. This function compares two regions of memory, at S1 and S2, for NUM
  22533. bytes.
  22534.  
  22535. Return Value
  22536. ------------
  22537.  
  22538. zero
  22539.      s1 == s2
  22540.  
  22541. positive
  22542.      s1 > s2
  22543.  
  22544. negative
  22545.      s1 < s2
  22546.  
  22547. Portability
  22548. -----------
  22549.  
  22550. ANSI, POSIX
  22551.  
  22552. 
  22553. File: libc.info,  Node: memcpy,  Next: memicmp,  Prev: memcmp,  Up: Alphabetical List
  22554.  
  22555. memcpy
  22556. ======
  22557.  
  22558. Syntax
  22559. ------
  22560.  
  22561.      #include <string.h>
  22562.      
  22563.      void *memcpy(void *dest, const void *src, int num);
  22564.  
  22565. Description
  22566. -----------
  22567.  
  22568. This function copies NUM bytes from SOURCE to DEST.  It assumes that
  22569. the source and destination regions don't overlap; if you need to copy
  22570. overlapping regions, use `memmove' instead.  *Note memmove::.
  22571.  
  22572. Return Value
  22573. ------------
  22574.  
  22575. DEST
  22576.  
  22577. Portability
  22578. -----------
  22579.  
  22580. ANSI, POSIX
  22581.  
  22582. Example
  22583. -------
  22584.  
  22585.      memcpy(buffer, temp_buffer, BUF_MAX);
  22586.  
  22587. 
  22588. File: libc.info,  Node: memicmp,  Next: memmove,  Prev: memcpy,  Up: Alphabetical List
  22589.  
  22590. memicmp
  22591. =======
  22592.  
  22593. Syntax
  22594. ------
  22595.  
  22596.      #include <string.h>
  22597.      
  22598.      int memicmp(const void *s1, const void *s2, size_t num);
  22599.  
  22600. Description
  22601. -----------
  22602.  
  22603. This function compares two regions of memory, at S1 and S2, for NUM
  22604. bytes, disregarding case.
  22605.  
  22606. Return Value
  22607. ------------
  22608.  
  22609. Zero if they're the same, nonzero if different, the sign indicates
  22610. "order".
  22611.  
  22612. Portability
  22613. -----------
  22614.  
  22615. not ANSI, not POSIX
  22616.  
  22617. Example
  22618. -------
  22619.  
  22620.      if (memicmp(arg, "-i", 2) == 0)   /* '-I' or '-include' etc. */
  22621.        do_include();
  22622.  
  22623. 
  22624. File: libc.info,  Node: memmove,  Next: memset,  Prev: memicmp,  Up: Alphabetical List
  22625.  
  22626. memmove
  22627. =======
  22628.  
  22629. Syntax
  22630. ------
  22631.  
  22632.      #include <string.h>
  22633.      
  22634.      void *memmove(void *dest, const void *source, int num);
  22635.  
  22636. Description
  22637. -----------
  22638.  
  22639. This function copies NUM bytes from SOURCE to DEST.  The copy is done
  22640. in such a way that if the two regions overlap, the source is always
  22641. read before that byte is changed by writing to the destination.
  22642.  
  22643. Return Value
  22644. ------------
  22645.  
  22646. DEST
  22647.  
  22648. Portability
  22649. -----------
  22650.  
  22651. ANSI, POSIX
  22652.  
  22653. Example
  22654. -------
  22655.  
  22656.      memmove(buf+1, buf, 99);
  22657.      memmove(buf, buf+1, 99);
  22658.  
  22659. 
  22660. File: libc.info,  Node: memset,  Next: mkdir,  Prev: memmove,  Up: Alphabetical List
  22661.  
  22662. memset
  22663. ======
  22664.  
  22665. Syntax
  22666. ------
  22667.  
  22668.      #include <string.h>
  22669.      
  22670.      void *memset(void *buffer, int ch, size_t num);
  22671.  
  22672. Description
  22673. -----------
  22674.  
  22675. This function stores NUM copies of CH, starting at BUFFER.  This is
  22676. often used to initialize objects to a known value, like zero.
  22677.  
  22678. Note that, although CH is declared `int' in the prototype, `memset'
  22679. only uses its least-significant byte to fill BUFFER.
  22680.  
  22681. Return Value
  22682. ------------
  22683.  
  22684. BUFFER
  22685.  
  22686. Portability
  22687. -----------
  22688.  
  22689. ANSI, POSIX
  22690.  
  22691. Example
  22692. -------
  22693.  
  22694.      struct tm t;
  22695.      memset(&t, 0, sizeof(t));
  22696.  
  22697. 
  22698. File: libc.info,  Node: mkdir,  Next: mkfifo,  Prev: memset,  Up: Alphabetical List
  22699.  
  22700. mkdir
  22701. =====
  22702.  
  22703. Syntax
  22704. ------
  22705.  
  22706.      #include <sys/stat.h>
  22707.      
  22708.      int mkdir(const char *path, mode_t mode);
  22709.  
  22710. Description
  22711. -----------
  22712.  
  22713. This function creates a subdirectory.
  22714.  
  22715. All the bits except `S_IWUSR' in the MODE argument are ignored under
  22716. MS-DOS.  If `S_IWUSR' is *not* set in MODE, the directory is created
  22717. with read-only attribute bit set.  Note that DOS itself ignores the
  22718. read-only bit of directories, but some programs do not.
  22719.  
  22720. Return Value
  22721. ------------
  22722.  
  22723. Zero if the subdirectory was created, nonzero on failure.
  22724.  
  22725. Portability
  22726. -----------
  22727.  
  22728. not ANSI, POSIX
  22729.  
  22730. Example
  22731. -------
  22732.  
  22733.      mkdir("/usr/tmp", S_IWUSR);
  22734.  
  22735. 
  22736. File: libc.info,  Node: mkfifo,  Next: mknod,  Prev: mkdir,  Up: Alphabetical List
  22737.  
  22738. mkfifo
  22739. ======
  22740.  
  22741. Syntax
  22742. ------
  22743.  
  22744.      #include <sys/stat.h>
  22745.      
  22746.      int mkfifo(const char *path, mode_t mode);
  22747.  
  22748. Description
  22749. -----------
  22750.  
  22751. This function is provided only to assist in porting from Unix.  It
  22752. always returns an error condition.
  22753.  
  22754. Portability
  22755. -----------
  22756.  
  22757. not ANSI, POSIX
  22758.  
  22759. 
  22760. File: libc.info,  Node: mknod,  Next: mkstemp,  Prev: mkfifo,  Up: Alphabetical List
  22761.  
  22762. mknod
  22763. =====
  22764.  
  22765. Syntax
  22766. ------
  22767.  
  22768.      #include <sys/stat.h>
  22769.      
  22770.      int mknod(const char *path, mode_t mode, dev_t dev);
  22771.  
  22772. Description
  22773. -----------
  22774.  
  22775. This function is provided to assist in porting from Unix.  If MODE
  22776. specifies a regular file, `mknod' creates a file using PATH as its
  22777. name.  If MODE specifies a character device, and if the device whose
  22778. name is given by PATH exists and its device specification as returned
  22779. by `stat' or `fstat' is equal to DEV, `mknod' returns -1 and sets
  22780. `errno' to `EEXIST'.  In all other cases, -1 is returned `errno' is set
  22781. to `EACCES'.
  22782.  
  22783. The argument DEV is ignored if MODE does not specify a character device.
  22784.  
  22785. Return Value
  22786. ------------
  22787.  
  22788. Zero on success, -1 on failure.
  22789.  
  22790. Portability
  22791. -----------
  22792.  
  22793. not ANSI, not POSIX
  22794.  
  22795. 
  22796. File: libc.info,  Node: mkstemp,  Next: mktemp,  Prev: mknod,  Up: Alphabetical List
  22797.  
  22798. mkstemp
  22799. =======
  22800.  
  22801. Syntax
  22802. ------
  22803.  
  22804.      #include <stdio.h>
  22805.      
  22806.      int mkstemp(char *template);
  22807.  
  22808. Description
  22809. -----------
  22810.  
  22811. TEMPLATE is a file specification that ends with six trailing `X'
  22812. characters.  This function replaces the `XXXXXX' with a set of
  22813. characters such that the resulting file name names a nonexisting file.
  22814. It then creates and opens the file in a way which guarantees that no
  22815. other process can access this file.
  22816.  
  22817. Note that since MS-DOS is limited to eight characters for the file name,
  22818. and since none of the `X''s get replaced by a dot, you can only have
  22819. two additional characters before the `X''s.
  22820.  
  22821. Note also that the path you give will be modified in place.
  22822.  
  22823. Return Value
  22824. ------------
  22825.  
  22826. The open file descriptor.
  22827.  
  22828. Portability
  22829. -----------
  22830.  
  22831. not ANSI, not POSIX
  22832.  
  22833. Example
  22834. -------
  22835.  
  22836.      char path[100];
  22837.      strcpy(path, "/tmp/ccXXXXXX");
  22838.      int fd = mkstemp(path);
  22839.  
  22840. 
  22841. File: libc.info,  Node: mktemp,  Next: mktime,  Prev: mkstemp,  Up: Alphabetical List
  22842.  
  22843. mktemp
  22844. ======
  22845.  
  22846. Syntax
  22847. ------
  22848.  
  22849.      #include <stdio.h>
  22850.      
  22851.      char *mktemp(char *template);
  22852.  
  22853. Description
  22854. -----------
  22855.  
  22856. TEMPLATE is a file specification that ends with six trailing `X'
  22857. characters.  This function replaces the `XXXXXX' with a set of
  22858. characters such that the resulting file name names a nonexisting file.
  22859.  
  22860. Note that since MS-DOS is limited to eight characters for the file name,
  22861. and since none of the `X''s get replaced by a dot, you can only have
  22862. two additional characters before the `X''s.
  22863.  
  22864. Return Value
  22865. ------------
  22866.  
  22867. The resulting filename.
  22868.  
  22869. Portability
  22870. -----------
  22871.  
  22872. not ANSI, not POSIX
  22873.  
  22874. Example
  22875. -------
  22876.  
  22877.      char template[] = "/tmp/ccXXXXXX";
  22878.      mktemp(template);
  22879.      FILE *q = fopen(template, "w");
  22880.  
  22881. 
  22882. File: libc.info,  Node: mktime,  Next: modf,  Prev: mktemp,  Up: Alphabetical List
  22883.  
  22884. mktime
  22885. ======
  22886.  
  22887. Syntax
  22888. ------
  22889.  
  22890.      #include <time.h>
  22891.      
  22892.      time_t mktime(struct tm *tptr);
  22893.  
  22894. Description
  22895. -----------
  22896.  
  22897. This function converts a time structure into the number of seconds since
  22898. 00:00:00 GMT 1/1/1970.  It also attempts to normalize the fields of
  22899. TPTR.  The layout of a `struct tm' is as follows:
  22900.  
  22901.      struct tm {
  22902.        int    tm_sec;    /* seconds after the minute [0-60] */
  22903.        int    tm_min;    /* minutes after the hour [0-59] */
  22904.        int    tm_hour;   /* hours since midnight [0-23] */
  22905.        int    tm_mday;   /* day of the month [1-31] */
  22906.        int    tm_mon;    /* months since January [0-11] */
  22907.        int    tm_year;   /* years since 1900 */
  22908.        int    tm_wday;   /* days since Sunday [0-6] */
  22909.        int    tm_yday;   /* days since January 1 [0-365] */
  22910.        int    tm_isdst;  /* Daylight Savings Time flag */
  22911.        long   tm_gmtoff; /* offset from GMT in seconds */
  22912.        char * tm_zone;   /* timezone abbreviation */
  22913.      };
  22914.  
  22915. If you don't know whether daylight saving is in effect at the moment
  22916. specified by the contents of TPTR, set the `tm_isdst' member to -1,
  22917. which will cause `mktime' to compute the DST flag using the data base
  22918. in the `zoneinfo' subdirectory of your main DJGPP installation.  This
  22919. requires that you set the environment variable `TZ' to a file in that
  22920. directory which corresponds to your geographical area.
  22921.  
  22922. Return Value
  22923. ------------
  22924.  
  22925. The resulting time, or -1 if the time in TPTR cannot be described in
  22926. that format.
  22927.  
  22928. Portability
  22929. -----------
  22930.  
  22931. ANSI, POSIX
  22932.  
  22933. 
  22934. File: libc.info,  Node: modf,  Next: modfl,  Prev: mktime,  Up: Alphabetical List
  22935.  
  22936. modf
  22937. ====
  22938.  
  22939. Syntax
  22940. ------
  22941.  
  22942.      #include <math.h>
  22943.      
  22944.      double modf(double x, double *pint);
  22945.  
  22946. Description
  22947. -----------
  22948.  
  22949. `modf' breaks down X into its integer portion (which it stores in
  22950. *PINT) and the remaining fractional portion, which it returns.  Both
  22951. integer and fractional portions have the same sign as X, except if X is
  22952. a negative zero, in which case the integer part is a positive zero.
  22953.  
  22954. Return Value
  22955. ------------
  22956.  
  22957. The fractional portion.  If X is `Inf' or `NaN', the return value is
  22958. zero, the integer portion stored in *PINT is the same as the value of
  22959. X, and `errno' is set to `EDOM'.
  22960.  
  22961. Portability
  22962. -----------
  22963.  
  22964. ANSI, POSIX
  22965.  
  22966. 
  22967. File: libc.info,  Node: modfl,  Next: _mono_clear,  Prev: modf,  Up: Alphabetical List
  22968.  
  22969. modfl
  22970. =====
  22971.  
  22972. Syntax
  22973. ------
  22974.  
  22975.      #include <math.h>
  22976.      
  22977.      long double modf(long double x, long double *pint);
  22978.  
  22979. Description
  22980. -----------
  22981.  
  22982. `modfl' breaks down X into its integer portion (which it stores in
  22983. *PINT) and the remaining fractional portion, which it returns.
  22984.  
  22985. Return Value
  22986. ------------
  22987.  
  22988. The fractional portion.
  22989.  
  22990. Portability
  22991. -----------
  22992.  
  22993. not ANSI, not POSIX
  22994.  
  22995. 
  22996. File: libc.info,  Node: _mono_clear,  Next: _mono_printf,  Prev: modfl,  Up: Alphabetical List
  22997.  
  22998. _mono_clear
  22999. ===========
  23000.  
  23001. Syntax
  23002. ------
  23003.  
  23004.      #include <sys/mono.h>
  23005.      
  23006.      void _mono_clear(void);
  23007.  
  23008. Description
  23009. -----------
  23010.  
  23011. Clears the monochrome monitor.
  23012.  
  23013. Portability
  23014. -----------
  23015.  
  23016. not ANSI, not POSIX
  23017.  
  23018. 
  23019. File: libc.info,  Node: _mono_printf,  Next: _mono_putc,  Prev: _mono_clear,  Up: Alphabetical List
  23020.  
  23021. _mono_printf
  23022. ============
  23023.  
  23024. Syntax
  23025. ------
  23026.  
  23027.      #include <sys/mono.h>
  23028.      
  23029.      void _mono_printf(const char *fmt, ...);
  23030.  
  23031. Description
  23032. -----------
  23033.  
  23034. Like *Note printf::, but prints to the monochrome monitor.
  23035.  
  23036. Portability
  23037. -----------
  23038.  
  23039. not ANSI, not POSIX
  23040.  
  23041. 
  23042. File: libc.info,  Node: _mono_putc,  Next: movedata,  Prev: _mono_printf,  Up: Alphabetical List
  23043.  
  23044. _mono_putc
  23045. ==========
  23046.  
  23047. Syntax
  23048. ------
  23049.  
  23050.      #include <sys/mono.h>
  23051.      
  23052.      void _mono_putc(int c);
  23053.  
  23054. Description
  23055. -----------
  23056.  
  23057. Prints a single character to the monochrome monitor.
  23058.  
  23059. Portability
  23060. -----------
  23061.  
  23062. not ANSI, not POSIX
  23063.  
  23064. 
  23065. File: libc.info,  Node: movedata,  Next: movedatab,  Prev: _mono_putc,  Up: Alphabetical List
  23066.  
  23067. movedata
  23068. ========
  23069.  
  23070. Syntax
  23071. ------
  23072.  
  23073.      #include <sys/movedata.h>
  23074.      
  23075.      void movedata(unsigned source_selector, unsigned source_offset,
  23076.                    unsigned dest_selector, unsigned dest_offset,
  23077.                    size_t length);
  23078.  
  23079. Description
  23080. -----------
  23081.  
  23082. This function allows the caller to directly transfer information
  23083. between conventional and linear memory, and among each as well.  The
  23084. selectors passed are *not* segment values like in DOS.  They are
  23085. protected mode selectors that can be obtained by the `_my_ds' and
  23086. `_go32_info_block.selector_for_linear_memory' (or just `_dos_ds')
  23087. functions (*Note _my_ds::, *Note _go32_info_block::).  The offsets are
  23088. linear offsets.  If the selector is for the program's data area, this
  23089. offset corresponds to the address of a buffer (like
  23090. `(unsigned)&something').  If the selector is for the conventional
  23091. memory area, the offset is the physical address of the memory, which
  23092. can be computed from a traditional segment/offset pair as
  23093. `segment'*16+`offset'.  For example, the color text screen buffer is at
  23094. offset 0xb8000.
  23095.  
  23096. Return Value
  23097. ------------
  23098.  
  23099. None.
  23100.  
  23101. Portability
  23102. -----------
  23103.  
  23104. not ANSI, not POSIX
  23105.  
  23106. Example
  23107. -------
  23108.  
  23109.      short blank_row_buf[ScreenCols()];
  23110.      /* scroll screen */
  23111.      movedata(_dos_ds, 0xb8000 + ScreenCols()*2,
  23112.               _dos_ds, 0xb8000,
  23113.               ScreenCols() * (ScreenRows()-1) * 2);
  23114.      /* fill last row */
  23115.      movedata(_my_ds(), (unsigned)blank_row_buf,
  23116.               _dos_ds, 0xb8000 + ScreenCols()*(ScreenRows()-1)*2,
  23117.                ScreenCols() * 2);
  23118.  
  23119. 
  23120. File: libc.info,  Node: movedatab,  Next: movedatal,  Prev: movedata,  Up: Alphabetical List
  23121.  
  23122. movedatab
  23123. =========
  23124.  
  23125. Syntax
  23126. ------
  23127.  
  23128.      #include <sys/movedata.h>
  23129.      
  23130.      void _movedatab(unsigned, unsigned, unsigned, unsigned, size_t);
  23131.  
  23132. Description
  23133. -----------
  23134.  
  23135. Just like *Note movedata::, but all transfers are always 8-bit
  23136. transfers.
  23137.  
  23138. Portability
  23139. -----------
  23140.  
  23141. not ANSI, not POSIX
  23142.  
  23143. 
  23144. File: libc.info,  Node: movedatal,  Next: movedataw,  Prev: movedatab,  Up: Alphabetical List
  23145.  
  23146. movedatal
  23147. =========
  23148.  
  23149. Syntax
  23150. ------
  23151.  
  23152.      #include <sys/movedata.h>
  23153.      
  23154.      void _movedatal(unsigned, unsigned, unsigned, unsigned, size_t);
  23155.  
  23156. Description
  23157. -----------
  23158.  
  23159. Just like *Note movedata::, but all transfers are always 32-bit
  23160. transfers, and the count is a count of transfers, not bytes.
  23161.  
  23162. Portability
  23163. -----------
  23164.  
  23165. not ANSI, not POSIX
  23166.  
  23167. 
  23168. File: libc.info,  Node: movedataw,  Next: movetext,  Prev: movedatal,  Up: Alphabetical List
  23169.  
  23170. movedataw
  23171. =========
  23172.  
  23173. Syntax
  23174. ------
  23175.  
  23176.      #include <sys/movedata.h>
  23177.      
  23178.      void _movedataw(unsigned, unsigned, unsigned, unsigned, size_t);
  23179.  
  23180. Description
  23181. -----------
  23182.  
  23183. Just like *Note movedata::, but all transfers are always 16-bit
  23184. transfers, and the count is a count of transfers, not bytes.
  23185.  
  23186. Portability
  23187. -----------
  23188.  
  23189. not ANSI, not POSIX
  23190.  
  23191. 
  23192. File: libc.info,  Node: movetext,  Next: mprotect,  Prev: movedataw,  Up: Alphabetical List
  23193.  
  23194. movetext
  23195. ========
  23196.  
  23197. Syntax
  23198. ------
  23199.  
  23200.      #include <conio.h>
  23201.      
  23202.      int movetext(int _left, int _top, int _right, int _bottom,
  23203.                   int _destleft, int _desttop);
  23204.  
  23205. Description
  23206. -----------
  23207.  
  23208. Moves a block of text on the screen.
  23209.  
  23210. Return Value
  23211. ------------
  23212.  
  23213. 1 on success, zero on error.
  23214.  
  23215. Portability
  23216. -----------
  23217.  
  23218. not ANSI, not POSIX
  23219.  
  23220. 
  23221. File: libc.info,  Node: mprotect,  Next: _my_cs,  Prev: movetext,  Up: Alphabetical List
  23222.  
  23223. mprotect
  23224. ========
  23225.  
  23226. Syntax
  23227. ------
  23228.  
  23229.      #include <sys/types.h>
  23230.      #include <sys/mman.h>
  23231.      
  23232.      int mprotect(void *addr, size_t len, int prot);
  23233.  
  23234. Description
  23235. -----------
  23236.  
  23237. This function modifies the access protection of a memory region.
  23238. Protection occurs in 4Kbyte regions (pages) aligned on 4Kbyte
  23239. boundaries.  All pages in the region will be changed, so ADDR and LEN
  23240. should be multiples of 4096.
  23241.  
  23242. The protection PROT for each page is specified with the values:
  23243. PROT_NONE  Region can not be touched (if or'ed is ignored).
  23244. PROT_READ  Region can be read (can be or'ed with PROT_WRITE).
  23245. PROT_WRITE Region can be written (implies read access).
  23246.  
  23247. This function is only supported on DPMI hosts which provide some V1.0
  23248. extensions on V0.9 memory blocks.
  23249.  
  23250. Return Value
  23251. ------------
  23252.  
  23253. The function returns 0 if successful and the value -1 if all the pages
  23254. could not be set.
  23255.  
  23256. Portability
  23257. -----------
  23258.  
  23259. not ANSI, not POSIX
  23260.  
  23261. Example
  23262. -------
  23263.  
  23264.      mprotect(readonly_buffer,8192,PROT_READ);
  23265.      mprotect(guard_area,4096,PROT_NONE);
  23266.      mprotect(NULL,4096,PROT_WRITE);    /* Let NULL pointers not generate exceptions */
  23267.  
  23268. 
  23269. File: libc.info,  Node: _my_cs,  Next: _my_ds,  Prev: mprotect,  Up: Alphabetical List
  23270.  
  23271. _my_cs
  23272. ======
  23273.  
  23274. Syntax
  23275. ------
  23276.  
  23277.      #include <sys/segments.h>
  23278.      
  23279.      unsigned short _my_cs();
  23280.  
  23281. Description
  23282. -----------
  23283.  
  23284. Returns the current `CS'.  This is useful for setting up interrupt
  23285. vectors and such.
  23286.  
  23287. Return Value
  23288. ------------
  23289.  
  23290. `CS'
  23291.  
  23292. Portability
  23293. -----------
  23294.  
  23295. not ANSI, not POSIX
  23296.  
  23297. 
  23298. File: libc.info,  Node: _my_ds,  Next: _my_ss,  Prev: _my_cs,  Up: Alphabetical List
  23299.  
  23300. _my_ds
  23301. ======
  23302.  
  23303. Syntax
  23304. ------
  23305.  
  23306.      #include <sys/segments.h>
  23307.      
  23308.      unsigned short _my_ds();
  23309.  
  23310. Description
  23311. -----------
  23312.  
  23313. Returns the current `DS'.  This is useful for setting up interrupt
  23314. vectors and such.
  23315.  
  23316. Return Value
  23317. ------------
  23318.  
  23319. `DS'
  23320.  
  23321. Portability
  23322. -----------
  23323.  
  23324. not ANSI, not POSIX
  23325.  
  23326. 
  23327. File: libc.info,  Node: _my_ss,  Next: nice,  Prev: _my_ds,  Up: Alphabetical List
  23328.  
  23329. _my_ss
  23330. ======
  23331.  
  23332. Syntax
  23333. ------
  23334.  
  23335.      #include <sys/segments.h>
  23336.      
  23337.      unsigned short _my_ss();
  23338.  
  23339. Description
  23340. -----------
  23341.  
  23342. Returns the current `SS'.  This is useful for setting up interrupt
  23343. vectors and such.
  23344.  
  23345. Return Value
  23346. ------------
  23347.  
  23348. `SS'
  23349.  
  23350. Portability
  23351. -----------
  23352.  
  23353. not ANSI, not POSIX
  23354.  
  23355. 
  23356. File: libc.info,  Node: nice,  Next: normvideo,  Prev: _my_ss,  Up: Alphabetical List
  23357.  
  23358. nice
  23359. ====
  23360.  
  23361. Syntax
  23362. ------
  23363.  
  23364.      #include <unistd.h>
  23365.      
  23366.      int nice(int _increment);
  23367.  
  23368. Description
  23369. -----------
  23370.  
  23371. Adjusts the priority of the process.  Provided for Unix compatibility
  23372. only.
  23373.  
  23374. Return Value
  23375. ------------
  23376.  
  23377. The new nice value.
  23378.  
  23379. Portability
  23380. -----------
  23381.  
  23382. not ANSI, not POSIX
  23383.  
  23384. 
  23385. File: libc.info,  Node: normvideo,  Next: nosound,  Prev: nice,  Up: Alphabetical List
  23386.  
  23387. normvideo
  23388. =========
  23389.  
  23390. Syntax
  23391. ------
  23392.  
  23393.      #include <conio.h>
  23394.      
  23395.      void normvideo(void);
  23396.  
  23397. Description
  23398. -----------
  23399.  
  23400. Resets the text attribute to what it was before the program started.
  23401.  
  23402. Portability
  23403. -----------
  23404.  
  23405. not ANSI, not POSIX
  23406.  
  23407. 
  23408. File: libc.info,  Node: nosound,  Next: ntohl,  Prev: normvideo,  Up: Alphabetical List
  23409.  
  23410. nosound
  23411. =======
  23412.  
  23413. Syntax
  23414. ------
  23415.  
  23416.      #include <pc.h>
  23417.      
  23418.      void nosound(void);
  23419.  
  23420. Description
  23421. -----------
  23422.  
  23423. Disable the PC speaker.
  23424.  
  23425. Portability
  23426. -----------
  23427.  
  23428. not ANSI, not POSIX
  23429.  
  23430. 
  23431. File: libc.info,  Node: ntohl,  Next: ntohs,  Prev: nosound,  Up: Alphabetical List
  23432.  
  23433. ntohl
  23434. =====
  23435.  
  23436. Syntax
  23437. ------
  23438.  
  23439.      #include <netinet/in.h>
  23440.      
  23441.      unsigned long ntohl(unsigned long val);
  23442.  
  23443. Description
  23444. -----------
  23445.  
  23446. This function converts from network formatted longs to host formatted
  23447. longs.  For the i386 and higher processors, this means that the bytes
  23448. are swapped from 1234 order to 4321 order.
  23449.  
  23450. Return Value
  23451. ------------
  23452.  
  23453. The host-order value.
  23454.  
  23455. Portability
  23456. -----------
  23457.  
  23458. not ANSI, not POSIX
  23459.  
  23460. Example
  23461. -------
  23462.  
  23463.      ip = ntohl(packet.ipaddr);
  23464.  
  23465. 
  23466. File: libc.info,  Node: ntohs,  Next: open,  Prev: ntohl,  Up: Alphabetical List
  23467.  
  23468. ntohs
  23469. =====
  23470.  
  23471. Syntax
  23472. ------
  23473.  
  23474.      #include <netinet/in.h>
  23475.      
  23476.      unsigned short ntohs(unsigned short val);
  23477.  
  23478. Description
  23479. -----------
  23480.  
  23481. This function converts from network formatted shorts to host formatted
  23482. shorts.  For the i386 and higher processors, this means that the bytes
  23483. are swapped from 12 order to 21 order.
  23484.  
  23485. Return Value
  23486. ------------
  23487.  
  23488. The host-order value.
  23489.  
  23490. Portability
  23491. -----------
  23492.  
  23493. not ANSI, not POSIX
  23494.  
  23495. Example
  23496. -------
  23497.  
  23498.      port = ntohs(tcp.port);
  23499.  
  23500. 
  23501. File: libc.info,  Node: open,  Next: _open,  Prev: ntohs,  Up: Alphabetical List
  23502.  
  23503. open
  23504. ====
  23505.  
  23506. Syntax
  23507. ------
  23508.  
  23509.      #include <fcntl.h>
  23510.      #include <sys/stat.h> /* for mode definitions */
  23511.      
  23512.      int open(const char *file, int mode /*, int permissions */);
  23513.  
  23514. Description
  23515. -----------
  23516.  
  23517. This function opens the named FILE in the given MODE, which is any
  23518. combination of the following:
  23519.  
  23520. `O_RDONLY'
  23521.      The file is opened for reading.
  23522.  
  23523. `O_WRONLY'
  23524.      The file is opened for writing.
  23525.  
  23526. `O_RDWR'
  23527.      The file is opened for both reading and writing.
  23528.  
  23529. `O_CREAT'
  23530.      If the file does not exist, it is created. *Note creat::.
  23531.  
  23532. `O_TRUNC'
  23533.      If the file does exist, it is truncated to zero bytes.
  23534.  
  23535. `O_EXCL'
  23536.      If the file exists, and `O_CREAT' is also specified, the `open'
  23537.      call will fail.
  23538.  
  23539. `O_APPEND'
  23540.      The file pointer is positioned at the end of the file before each
  23541.      write.
  23542.  
  23543. `O_TEXT'
  23544.      The file is opened in text mode, meaning that Ctrl-M characters are
  23545.      stripped on reading and added on writing as needed.  The default
  23546.      mode is specified by the `_fmode' variable *Note _fmode::.
  23547.  
  23548. `O_BINARY'
  23549.      The file is opened in binary mode.
  23550.  
  23551.      When called to open the console in binary mode, `open' will disable
  23552.      the generation of `SIGINT' when you press `Ctrl-C' (`Ctrl-Break'
  23553.      will still cause `SIGINT'), because many programs that use binary
  23554.      reads from the console will also want to get the `^C' characters.
  23555.      You can use the `__djgpp_set_ctrl_c' library function (*note
  23556.      __djgpp_set_ctrl_c::.) if you want `Ctrl-C' to generate interrupts
  23557.      while console is read in binary mode.
  23558.  
  23559. If the file is created by this call, it will be given the read/write
  23560. permissions specified by PERMISSIONS, which may be any combination of
  23561. these values:
  23562.  
  23563. `S_IRUSR'
  23564.      The file is readable.  This is always true for MS-DOS.
  23565.  
  23566. `S_IWUSR'
  23567.      The file is writable.
  23568.  
  23569. Other `S_I*' values may be included, but they will be ignored.
  23570.  
  23571. You can specify the share flags (a DOS specific feature) in MODE.  And
  23572. you can indicate default values for the share flags in
  23573. `__djgpp_share_flags'. *Note __djgpp_share_flags::.
  23574.  
  23575. Return Value
  23576. ------------
  23577.  
  23578. If successful, the file descriptor is returned.  On error, a negative
  23579. number is returned and `errno' is set to indicate the error.
  23580.  
  23581. Portability
  23582. -----------
  23583.  
  23584. not ANSI, POSIX
  23585.  
  23586. Example
  23587. -------
  23588.  
  23589.      int q = open("/tmp/foo.dat", O_RDONLY|O_BINARY);
  23590.  
  23591. 
  23592. File: libc.info,  Node: _open,  Next: opendir,  Prev: open,  Up: Alphabetical List
  23593.  
  23594. _open
  23595. =====
  23596.  
  23597. Syntax
  23598. ------
  23599.  
  23600.      #include <io.h>
  23601.      
  23602.      int _open(const char *path, int attrib);
  23603.  
  23604. Description
  23605. -----------
  23606.  
  23607. This is a direct connection to the MS-DOS open function call, int 0x21,
  23608. %ah = 0x3d.  (When long file names are supported, `_open' calls
  23609. function 0x716c of Int 0x21.)  The file is set to binary mode.
  23610.  
  23611. This function can be hooked by the "File System Extensions" (*note File
  23612. System Extensions::.).  If you don't want this, you should use
  23613. `_dos_open' (*note _dos_open::.) (but note that the latter doesn't
  23614. support long file names).
  23615.  
  23616. Return Value
  23617. ------------
  23618.  
  23619. The new file descriptor, else -1 on error.
  23620.  
  23621. Portability
  23622. -----------
  23623.  
  23624. not ANSI, not POSIX
  23625.  
  23626. 
  23627. File: libc.info,  Node: opendir,  Next: outb,  Prev: _open,  Up: Alphabetical List
  23628.  
  23629. opendir
  23630. =======
  23631.  
  23632. Syntax
  23633. ------
  23634.  
  23635.      #include <dirent.h>
  23636.      
  23637.      extern int __opendir_flags;
  23638.      
  23639.      DIR *opendir(char *name);
  23640.  
  23641. Description
  23642. -----------
  23643.  
  23644. This function "opens" a directory so that you can read the list of file
  23645. names in it.  The pointer returned must be passed to `closedir' when
  23646. you are done with it.  *Note readdir::.
  23647.  
  23648. The global variable `__opendir_flags' can be set to include the
  23649. following values to control the operation of `opendir':
  23650.  
  23651. `__OPENDIR_PRESERVE_CASE'
  23652.      Do not change the case of files to lower case.  Just in case
  23653.      Micros*ft decides to support case-sensitive file systems some day.
  23654.  
  23655.      You can also use this flag if you want the names of files like
  23656.      `README' and `FAQ' from Unix distributions to be returned in
  23657.      upper-case on Windows 9X filesystems.  *Note _preserve_fncase::,
  23658.      for other ways of achieving this and for more detailed description
  23659.      of the automatic letter-case conversion by DJGPP library functions.
  23660.  
  23661. `__OPENDIR_NO_HIDDEN'
  23662.      Do not include hidden files and directories in the search.  By
  23663.      default, all files and directories are included.
  23664.  
  23665. `__OPENDIR_FIND_HIDDEN'
  23666.      Provided for back-compatibility with previous DJGPP versions, where
  23667.      hidden files and directories were by default skipped.  In versions
  23668.      2.02 and later, this flag has no effect.
  23669.  
  23670. `__OPENDIR_FIND_LABEL'
  23671.      Include volume labels in the search.  By default, these are
  23672.      skipped.
  23673.  
  23674. You can simply put `int __opendir_flags = ...;' in your code.  The
  23675. default is to let it get set to zero as an uninitialized variable.
  23676.  
  23677. Return Value
  23678. ------------
  23679.  
  23680. The open directory structure, or `NULL' on error.
  23681.  
  23682. Portability
  23683. -----------
  23684.  
  23685. not ANSI, POSIX (see note 1)
  23686.  
  23687. Notes:
  23688.  
  23689.   1. The `__opendir_flags' variable is DJGPP-specific.
  23690.  
  23691. Example
  23692. -------
  23693.  
  23694.      DIR *d = opendir(".");
  23695.      closedir(d);
  23696.  
  23697. 
  23698. File: libc.info,  Node: outb,  Next: outp,  Prev: opendir,  Up: Alphabetical List
  23699.  
  23700. outb
  23701. ====
  23702.  
  23703. Syntax
  23704. ------
  23705.  
  23706.      #include <pc.h>
  23707.      
  23708.      void outb(unsigned short _port, unsigned char _data);
  23709.  
  23710. Description
  23711. -----------
  23712.  
  23713. Calls *Note outportb::. Provided only for compatibility.
  23714.  
  23715. Portability
  23716. -----------
  23717.  
  23718. not ANSI, not POSIX
  23719.  
  23720. 
  23721. File: libc.info,  Node: outp,  Next: outportb,  Prev: outb,  Up: Alphabetical List
  23722.  
  23723. outp
  23724. ====
  23725.  
  23726. Syntax
  23727. ------
  23728.  
  23729.      #include <pc.h>
  23730.      
  23731.      void outp(unsigned short _port, unsigned char  _data);
  23732.  
  23733. Description
  23734. -----------
  23735.  
  23736. Calls *Note outportb::. Provided only for compatibility.
  23737.  
  23738. Portability
  23739. -----------
  23740.  
  23741. not ANSI, not POSIX
  23742.  
  23743. 
  23744. File: libc.info,  Node: outportb,  Next: outportl,  Prev: outp,  Up: Alphabetical List
  23745.  
  23746. outportb
  23747. ========
  23748.  
  23749. Syntax
  23750. ------
  23751.  
  23752.      #include <pc.h>
  23753.      
  23754.      void outportb(unsigned short _port, unsigned char  _data);
  23755.  
  23756. Description
  23757. -----------
  23758.  
  23759. Write a single byte to an 8-bit port.
  23760.  
  23761. This function is provided as an inline assembler macro, and will be
  23762. optimized down to a single opcode when you optimize your program.
  23763.  
  23764. Portability
  23765. -----------
  23766.  
  23767. not ANSI, not POSIX
  23768.  
  23769. 
  23770. File: libc.info,  Node: outportl,  Next: outportsb,  Prev: outportb,  Up: Alphabetical List
  23771.  
  23772. outportl
  23773. ========
  23774.  
  23775. Syntax
  23776. ------
  23777.  
  23778.      #include <pc.h>
  23779.      
  23780.      void outportl(unsigned short _port, unsigned long _data);
  23781.  
  23782. Description
  23783. -----------
  23784.  
  23785. Write a single long to an 32-bit port.
  23786.  
  23787. This function is provided as an inline assembler macro, and will be
  23788. optimized down to a single opcode when you optimize your program.
  23789.  
  23790. Portability
  23791. -----------
  23792.  
  23793. not ANSI, not POSIX
  23794.  
  23795. 
  23796. File: libc.info,  Node: outportsb,  Next: outportsl,  Prev: outportl,  Up: Alphabetical List
  23797.  
  23798. outportsb
  23799. =========
  23800.  
  23801. Syntax
  23802. ------
  23803.  
  23804.      #include <pc.h>
  23805.      
  23806.      void outportsb(unsigned short _port, const unsigned char *_buf, unsigned _len);
  23807.  
  23808. Description
  23809. -----------
  23810.  
  23811. Writes the _LEN bytes in _BUF to the 8-bit _PORT.
  23812.  
  23813. Portability
  23814. -----------
  23815.  
  23816. not ANSI, not POSIX
  23817.  
  23818. 
  23819. File: libc.info,  Node: outportsl,  Next: outportsw,  Prev: outportsb,  Up: Alphabetical List
  23820.  
  23821. outportsl
  23822. =========
  23823.  
  23824. Syntax
  23825. ------
  23826.  
  23827.      #include <pc.h>
  23828.      
  23829.      void outportsl(unsigned short _port, const unsigned long *_buf, unsigned _len);
  23830.  
  23831. Description
  23832. -----------
  23833.  
  23834. Writes the _LEN longs in _BUF to the 32-bit _PORT.
  23835.  
  23836. Portability
  23837. -----------
  23838.  
  23839. not ANSI, not POSIX
  23840.  
  23841. 
  23842. File: libc.info,  Node: outportsw,  Next: outportw,  Prev: outportsl,  Up: Alphabetical List
  23843.  
  23844. outportsw
  23845. =========
  23846.  
  23847. Syntax
  23848. ------
  23849.  
  23850.      #include <pc.h>
  23851.      
  23852.      void outportsw(unsigned short _port, const unsigned short *_buf, unsigned _len);
  23853.  
  23854. Description
  23855. -----------
  23856.  
  23857. Writes the _LEN shorts in _BUF to the 16-bit _PORT.
  23858.  
  23859. Portability
  23860. -----------
  23861.  
  23862. not ANSI, not POSIX
  23863.  
  23864. 
  23865. File: libc.info,  Node: outportw,  Next: outpw,  Prev: outportsw,  Up: Alphabetical List
  23866.  
  23867. outportw
  23868. ========
  23869.  
  23870. Syntax
  23871. ------
  23872.  
  23873.      #include <pc.h>
  23874.      
  23875.      void outportw(unsigned short _port, unsigned short _data);
  23876.  
  23877. Description
  23878. -----------
  23879.  
  23880. Write a single short to an 16-bit port.
  23881.  
  23882. This function is provided as an inline assembler macro, and will be
  23883. optimized down to a single opcode when you optimize your program.
  23884.  
  23885. Portability
  23886. -----------
  23887.  
  23888. not ANSI, not POSIX
  23889.  
  23890. 
  23891. File: libc.info,  Node: outpw,  Next: pathconf,  Prev: outportw,  Up: Alphabetical List
  23892.  
  23893. outpw
  23894. =====
  23895.  
  23896. Syntax
  23897. ------
  23898.  
  23899.      #include <pc.h>
  23900.      
  23901.      void outpw(unsigned short _port, unsigned short _data);
  23902.  
  23903. Description
  23904. -----------
  23905.  
  23906. Calls *Note outportw::. Provided only for compatibility.
  23907.  
  23908. Portability
  23909. -----------
  23910.  
  23911. not ANSI, not POSIX
  23912.  
  23913. 
  23914. File: libc.info,  Node: pathconf,  Next: pause,  Prev: outpw,  Up: Alphabetical List
  23915.  
  23916. pathconf
  23917. ========
  23918.  
  23919. Syntax
  23920. ------
  23921.  
  23922.      #include <unistd.h>
  23923.      
  23924.      long pathconf(const char *filename, int name);
  23925.  
  23926. Description
  23927. -----------
  23928.  
  23929. This function returns various system-dependent configuration values.
  23930. The NAME is one of the following:
  23931.  
  23932. `_PC_LINK_MAX'
  23933.      The maximum number of directory entries that can refer to a single
  23934.      real file.  Always 1 in DJGPP.
  23935.  
  23936. `_PC_MAX_CANON'
  23937.      The maximum number of bytes in an editable input line.  In DJGPP,
  23938.      this is 126 (DOS restriction).
  23939.  
  23940. `_PC_MAX_INPUT'
  23941.      The maximum number of bytes in a non-editable input line.  Also
  23942.      126 in DJGPP.
  23943.  
  23944. `_PC_NAME_MAX'
  23945.      The maximum length of an individual file name.  If the filesystem
  23946.      where FILENAME resides supports long file names, the result is
  23947.      whatever `_get_volume_info' returns (usually 255); otherwise 12
  23948.      will be returned.  *Note _use_lfn::.
  23949.  
  23950. `_PC_PATH_MAX'
  23951.      The maximum length of a complete path name.  If the filesystem
  23952.      where FILENAME resides supports long file names, the result is
  23953.      whatever `_get_volume_info' returns (usually 260); otherwise 80
  23954.      will be returned.  *Note _use_lfn::.
  23955.  
  23956. `_PC_PIPE_BUF'
  23957.      The size of a pipe's internal buffer.  In DJGPP, this returns 512.
  23958.  
  23959. `_PC_CHOWN_RESTRICTED'
  23960.      If non-zero, only priviledged user can change the ownership of
  23961.      files by calling `chown', otherwise anyone may give away files.
  23962.      The DJGPP version always returns zero, since MS-DOS files can be
  23963.      freely given away.
  23964.  
  23965. `_PC_NO_TRUNC'
  23966.      If zero is returned, filenames longer than what
  23967.      `pathconf (filename, _PC_NAME_MAX)' returns are truncated,
  23968.      otherwise an error occurs if you use longer names.  In DJGPP, this
  23969.      returns 0, since DOS always silently truncates long names.
  23970.  
  23971. `_PC_VDISABLE'
  23972.      A character to use to disable tty special characters.  DJGPP
  23973.      currently doesn't support special characters, so this returns -1.
  23974.  
  23975. Return Value
  23976. ------------
  23977.  
  23978. The selected configuration value is returned.
  23979.  
  23980. Portability
  23981. -----------
  23982.  
  23983. not ANSI, POSIX
  23984.  
  23985. Example
  23986. -------
  23987.  
  23988.      char *buf = malloc(pathconf("c:/", _PC_MAX_PATH)+1);
  23989.  
  23990. 
  23991. File: libc.info,  Node: pause,  Next: pclose,  Prev: pathconf,  Up: Alphabetical List
  23992.  
  23993. pause
  23994. =====
  23995.  
  23996. Syntax
  23997. ------
  23998.  
  23999.      #include <unistd.h>
  24000.      
  24001.      int pause(void);
  24002.  
  24003. Description
  24004. -----------
  24005.  
  24006. This function just calls `__dpmi_yield()' (*note __dpmi_yield::.)  to
  24007. give up a slice of the CPU.
  24008.  
  24009. Return Value
  24010. ------------
  24011.  
  24012. Zero.
  24013.  
  24014. Portability
  24015. -----------
  24016.  
  24017. not ANSI, POSIX
  24018.  
  24019. 
  24020. File: libc.info,  Node: pclose,  Next: perror,  Prev: pause,  Up: Alphabetical List
  24021.  
  24022. pclose
  24023. ======
  24024.  
  24025. Syntax
  24026. ------
  24027.  
  24028.      #include <stdio.h>
  24029.      
  24030.      int pclose(FILE *pipe);
  24031.  
  24032. Description
  24033. -----------
  24034.  
  24035. This function closes a pipe opened with `popen' (*note popen::.).  Note
  24036. that since MS-DOS is not multitasking, this function will actually run
  24037. the program specified in `popen' if the pipe was opened for writing.
  24038.  
  24039. Return Value
  24040. ------------
  24041.  
  24042. Zero on success, nonzero on failure.
  24043.  
  24044. Portability
  24045. -----------
  24046.  
  24047. not ANSI, POSIX
  24048.  
  24049. Example
  24050. -------
  24051.  
  24052.      FILE *f = popen("sort", "w");
  24053.      write_to_pipe(f);
  24054.      pclose(f);
  24055.  
  24056. 
  24057. File: libc.info,  Node: perror,  Next: pipe,  Prev: pclose,  Up: Alphabetical List
  24058.  
  24059. perror
  24060. ======
  24061.  
  24062. Syntax
  24063. ------
  24064.  
  24065.      #include <stdio.h>
  24066.      
  24067.      void perror(const char *string);
  24068.  
  24069. Description
  24070. -----------
  24071.  
  24072. This function formats an error message and prints it to `stderr'.  The
  24073. message is the STRING, a colon, and a message suitable for the error
  24074. condition indicated by `errno'.
  24075.  
  24076. Return Value
  24077. ------------
  24078.  
  24079. None.
  24080.  
  24081. Portability
  24082. -----------
  24083.  
  24084. ANSI, POSIX
  24085.  
  24086. Example
  24087. -------
  24088.  
  24089.      int x = open("foo", O_RDONLY);
  24090.      if (x < 0)
  24091.      {
  24092.        perror("foo");
  24093.        exit(1);
  24094.      }
  24095.  
  24096. 
  24097. File: libc.info,  Node: pipe,  Next: popen,  Prev: perror,  Up: Alphabetical List
  24098.  
  24099. pipe
  24100. ====
  24101.  
  24102. Syntax
  24103. ------
  24104.  
  24105.      #include <unistd.h>
  24106.      
  24107.      int pipe(int fildes[2]);
  24108.  
  24109. Description
  24110. -----------
  24111.  
  24112. This function is provided only to assist in porting from Unix.  It
  24113. always returns an error condition.
  24114.  
  24115. Portability
  24116. -----------
  24117.  
  24118. not ANSI, POSIX
  24119.  
  24120. 
  24121. File: libc.info,  Node: popen,  Next: pow,  Prev: pipe,  Up: Alphabetical List
  24122.  
  24123. popen
  24124. =====
  24125.  
  24126. Syntax
  24127. ------
  24128.  
  24129.      #include <stdio.h>
  24130.      
  24131.      FILE *popen(const char *program, const char *mode);
  24132.  
  24133. Description
  24134. -----------
  24135.  
  24136. This function executes the named `program' and attaches either its
  24137. input stream or its output stream to the returned file.  While the file
  24138. is open, the calling program can write to the program (if the program
  24139. was open for writing) or read the program's output (if the program was
  24140. opened for reading).  When the program is done, or if you have no more
  24141. input for it, pass the file pointer to `pclose' (*note pclose::.),
  24142. which terminates the program.
  24143.  
  24144. Since MS-DOS does not support multitasking, this function actually runs
  24145. the entire program when the program is opened for reading, and stores
  24146. the output in a temporary file.  `pclose' then removes that file.
  24147. Similarly, when you open a program for writing, a temp file holds the
  24148. data and `pclose' runs the entire program.
  24149.  
  24150. The MODE is the same as for `fopen' (*note fopen::.).
  24151.  
  24152. Return Value
  24153. ------------
  24154.  
  24155. An open file which can be used to read the program's output or write to
  24156. the program's input.
  24157.  
  24158. Portability
  24159. -----------
  24160.  
  24161. not ANSI, POSIX
  24162.  
  24163. Example
  24164. -------
  24165.  
  24166.      FILE *p = popen("dir", "r");
  24167.      read_program(p);
  24168.      pclose(p);
  24169.  
  24170. 
  24171. File: libc.info,  Node: pow,  Next: pow10,  Prev: popen,  Up: Alphabetical List
  24172.  
  24173. pow
  24174. ===
  24175.  
  24176. Syntax
  24177. ------
  24178.  
  24179.      #include <math.h>
  24180.      
  24181.      double pow(double x, double y);
  24182.  
  24183. Description
  24184. -----------
  24185.  
  24186. This function computes X^Y, X raised to the power Y.
  24187.  
  24188. Return Value
  24189. ------------
  24190.  
  24191. X raised to the power Y.  If the result overflows a `double' or
  24192. underflows, `errno' is set to `ERANGE'.  If Y is `NaN', the return
  24193. value is `NaN' and `errno' is set to `EDOM'.  If X and Y are both 0,
  24194. the return value is 1, but `errno' is set to `EDOM'.  If Y is a
  24195. positive or a negative Infinity, the following results are returned,
  24196. depending on the value of X:
  24197.  
  24198. X negative
  24199.      the return value is `NaN' and `errno' is set to `EDOM'.
  24200.  
  24201. absolute value of X less than 1 and Y is `+Inf'
  24202. absolute value of X greater than 1 and Y is `-Inf'
  24203.      the return value is zero.
  24204.  
  24205. absolute value of X less than 1 and Y is `-Inf'
  24206. absolute value of X greater than 1 and Y is `+Inf'
  24207.      the return value is `+Inf'.
  24208.  
  24209. absolute value of X is 1
  24210.      the return value is `NaN' and `errno' is set to `EDOM'.
  24211.  
  24212. Portability
  24213. -----------
  24214.  
  24215. ANSI, POSIX
  24216.  
  24217. 
  24218. File: libc.info,  Node: pow10,  Next: pow2,  Prev: pow,  Up: Alphabetical List
  24219.  
  24220. pow10
  24221. =====
  24222.  
  24223. Syntax
  24224. ------
  24225.  
  24226.      #include <math.h>
  24227.      
  24228.      double pow10(double x);
  24229.  
  24230. Description
  24231. -----------
  24232.  
  24233. This function computes 10 to the power of X, 10^x.
  24234.  
  24235. Return Value
  24236. ------------
  24237.  
  24238. 10 to the X power.  If the value of X is finite, but so large in
  24239. magnitude that 10^x cannot be accurately represented by a `double', the
  24240. return value is the nearest representable !  `double' (possibly, an
  24241. `Inf'), and `errno' is set to `ERANGE'.  If X is either a positive or a
  24242. negative infinity, the result is either `+Inf' or zero, respectively,
  24243. and `errno' is not changed.  If X is a `NaN', the return value is `NaN'
  24244. and `errno' is set to `EDOM'.
  24245.  
  24246. Portability
  24247. -----------
  24248.  
  24249. not ANSI, not POSIX
  24250.  
  24251. 
  24252. File: libc.info,  Node: pow2,  Next: powi,  Prev: pow10,  Up: Alphabetical List
  24253.  
  24254. pow2
  24255. ====
  24256.  
  24257. Syntax
  24258. ------
  24259.  
  24260.      #include <math.h>
  24261.      
  24262.      double pow2(double x);
  24263.  
  24264. Description
  24265. -----------
  24266.  
  24267. This function computes 2 to the power of X, 2^x.
  24268.  
  24269. Return Value
  24270. ------------
  24271.  
  24272. 2 to the X power.  If the value of X is finite, but so large in
  24273. magnitude that 2^x cannot be accurately represented by a `double', the
  24274. return value is the nearest representable `double' (possibly, an
  24275. `Inf'), and `errno' is set to `ERANGE'.  If X is either a positive or a
  24276. negative infinity, the result is either `+Inf' or zero, respectively,
  24277. and `errno' is not changed.  If X is a `NaN', the return value is `NaN'
  24278. and `errno' is set to `EDOM'.
  24279.  
  24280. Portability
  24281. -----------
  24282.  
  24283. not ANSI, not POSIX
  24284.  
  24285. 
  24286. File: libc.info,  Node: powi,  Next: _preserve_fncase,  Prev: pow2,  Up: Alphabetical List
  24287.  
  24288. powi
  24289. ====
  24290.  
  24291. Syntax
  24292. ------
  24293.  
  24294.      #include <math.h>
  24295.      
  24296.      double powi(double x, int iy);
  24297.  
  24298. Description
  24299. -----------
  24300.  
  24301. This function computes x^iy, where IY is an integer number.  It does so
  24302. by an optimized sequence of squarings and multiplications.  For integer
  24303. values of exponent, it is always faster to call `powi' than to call
  24304. `pow' with the same arguments, even if IY has a very large value.  For
  24305. small values of IY, `powi' is *much* faster than `pow'.
  24306.  
  24307. Return Value
  24308. ------------
  24309.  
  24310. X raised to the IY power.  If X and IY are both zero, the return value
  24311. is 1.  If X is equal to zero, and IY is negative, the return value is
  24312. `Inf'.  This function never sets `errno'.
  24313.  
  24314. Portability
  24315. -----------
  24316.  
  24317. not ANSI, not POSIX
  24318.  
  24319. 
  24320. File: libc.info,  Node: _preserve_fncase,  Next: printf,  Prev: powi,  Up: Alphabetical List
  24321.  
  24322. _preserve_fncase
  24323. ================
  24324.  
  24325. Syntax
  24326. ------
  24327.  
  24328.      #include <fcntl.h>
  24329.      
  24330.      char _preserve_fncase (void);
  24331.  
  24332. Description
  24333. -----------
  24334.  
  24335. This function returns a non-zero value if letter-case in filenames
  24336. should be preserved.  It is used by library functions that get filenames
  24337. from the operating system (like `readdir', `_fixpath' and others).  The
  24338. usual behavior of these functions (when `_preserve_fncase' returns
  24339. zero) is to down-case 8+3 DOS-style filenames, but leave alone the
  24340. letter-case in long filenames when these are supported (*note
  24341. _use_lfn::.).  This can be changed by either setting
  24342. `_CRT0_FLAG_PRESERVE_FILENAME_CASE' bit in the `_crt0_startup_flags'
  24343. variable (*note _crt0_startup_flags::.), or by setting the `FNCASE'
  24344. environment variable to `Y' at run time.  You might need such a setup
  24345. e.g. on Windows 95 if you want to see files with names like `README'
  24346. and `FAQ' listed in upper-case (for this to work, you will have to
  24347. manually rename all the other files with 8+3 DOS-style names to
  24348. lower-case names).  When the case in filenames is preserved, all
  24349. filenames will be returned in upper case on MSDOS (and other systems
  24350. that don't support long filenames), or if the environment variable
  24351. `LFN' is set to `N' on systems that support LFN.  That is because this
  24352. is how filenames are stored in the DOS directory entries.
  24353.  
  24354. Return value
  24355. ------------
  24356.  
  24357. Zero when 8+3 filenames should be converted to lower-case, non-zero
  24358. otherwise.
  24359.  
  24360. Portability
  24361. -----------
  24362.  
  24363. not ANSI, not POSIX
  24364.  
  24365. 
  24366. File: libc.info,  Node: printf,  Next: psignal,  Prev: _preserve_fncase,  Up: Alphabetical List
  24367.  
  24368. printf
  24369. ======
  24370.  
  24371. Syntax
  24372. ------
  24373.  
  24374.      #include <stdio.h>
  24375.      
  24376.      int printf(const char *format, ...);
  24377.  
  24378. Description
  24379. -----------
  24380.  
  24381. Sends formatted output from the arguments (...) to `stdout'.
  24382.  
  24383. The format string contains regular characters to print, as well as
  24384. conversion specifiers, which begin with a percent symbol.  Each
  24385. conversion speficier contains the following fields:
  24386.  
  24387.    *  an optional flag, which may alter the conversion:
  24388.  
  24389.     `-'
  24390.           left-justify the field.
  24391.  
  24392.     `+'
  24393.           Force a `+' sign on positive numbers.
  24394.  
  24395.     `space'
  24396.           To leave a blank space where a plus or minus sign would have
  24397.           been.
  24398.  
  24399.     `#'
  24400.           Alternate conversion - prefix octal numbers with `0',
  24401.           hexadecimal numbers with `0x' or `0X', or force a trailing
  24402.           decimal point if a floating point conversion would have
  24403.           omitted it.
  24404.  
  24405.     `0'
  24406.           To pad numbers with leading zeros.
  24407.  
  24408.    *  A field width specifier, which specifies the minimum width of the
  24409.      field.  This may also be an asterisk (`*'), which means that the
  24410.      actual width will be obtained from the next argument.  If the
  24411.      argument is negative, it supplies a `-' flag and a positive width.
  24412.  
  24413.    *  An optional decimal point and a precision.  This may also be an
  24414.      asterisk, but a negative argument for it indicates a precision of
  24415.      zero.  The precision specifies the minimum number of digits to
  24416.      print for an integer, the number of fraction digits for a floating
  24417.      point number (max for `g' or `G', actual for others), or the
  24418.      maximum number of characters for a string.
  24419.  
  24420.    *  An optional conversion qualifier, which may be `h' to specify
  24421.      `short', `l' to specify long ints, or `L' to specify long doubles.
  24422.      Long long type can be specified by `L' or `ll'.
  24423.  
  24424.    *  The conversion type specifier:
  24425.  
  24426.     `c'
  24427.           A single character
  24428.  
  24429.     `d'
  24430.           A signed integer
  24431.  
  24432.     `D'
  24433.           A signed long integer
  24434.  
  24435.     `e'
  24436.     `E'
  24437.           A floating point number (double or long double).  The
  24438.           exponent case matches the specifier case.  The representation
  24439.           always has an exponent.
  24440.  
  24441.     `f'
  24442.           A floating point number (double or long double).  The
  24443.           representation never has an exponent.
  24444.  
  24445.     `g'
  24446.     `G'
  24447.           A floating point number (double or long double).  The
  24448.           exponent case matches the specifier case.  The representation
  24449.           has an exponent if it needs one.
  24450.  
  24451.     `i'
  24452.           A signed integer.
  24453.  
  24454.     `n'
  24455.           The next argument is a pointer to an integer, and the number
  24456.           of characters generated so far is stored in that integer.
  24457.  
  24458.     `o'
  24459.           A unsigned integer, printed in base 8 instead of base 10.
  24460.  
  24461.     `p'
  24462.           A pointer.  This is printed with an `x' specifier.
  24463.  
  24464.     `s'
  24465.           A `NULL'-terminated string.
  24466.  
  24467.     `u'
  24468.           An unsigned integer.
  24469.  
  24470.     `U'
  24471.           An unsigned long integer.
  24472.  
  24473.     `x'
  24474.     `X'
  24475.           An unsigned integer, printed in base 16 instead of base 10.
  24476.           The case of the letters used matches the specifier case.
  24477.  
  24478.     `%'
  24479.           A single percent symbol is printed.
  24480.  
  24481. Return Value
  24482. ------------
  24483.  
  24484. The number of characters written.
  24485.  
  24486. Portability
  24487. -----------
  24488.  
  24489. ANSI, POSIX
  24490.  
  24491. Example
  24492. -------
  24493.  
  24494.      printf("%-3d %10.2f%% Percent of %s\n", index, per[index], name[index]);
  24495.  
  24496. 
  24497. File: libc.info,  Node: psignal,  Next: _put_path,  Prev: printf,  Up: Alphabetical List
  24498.  
  24499. psignal
  24500. =======
  24501.  
  24502. Syntax
  24503. ------
  24504.  
  24505.      #include <signal.h>
  24506.      
  24507.      extern char *sys_siglist[];
  24508.      void psignal (int sig, const char *msg);
  24509.  
  24510. Description
  24511. -----------
  24512.  
  24513. This function produces a message on the standard error stream describing
  24514. the signal given by its number in SIG.  It prints the string pointed to
  24515. by MSG, then the name of the signal, and a newline.
  24516.  
  24517. The names of signals can be retrieved using the array `sys_siglist',
  24518. with the signal number serving as an index into this array.
  24519.  
  24520. Portability
  24521. -----------
  24522.  
  24523. not ANSI, not POSIX
  24524.  
  24525. Example
  24526. -------
  24527.  
  24528.        #include <signal.h>
  24529.      
  24530.        void sig_catcher (int sig)
  24531.        {
  24532.          psignal (progname, sig);
  24533.          return;
  24534.        }
  24535.  
  24536. 
  24537. File: libc.info,  Node: _put_path,  Next: putc,  Prev: psignal,  Up: Alphabetical List
  24538.  
  24539. _put_path
  24540. =========
  24541.  
  24542. Syntax
  24543. ------
  24544.  
  24545.      #include <libc/dosio.h>
  24546.      
  24547.      int _put_path(const char *path);
  24548.      int _put_path2(const char *path, int offset);
  24549.  
  24550. Description
  24551. -----------
  24552.  
  24553. These functions are used internally by all low-level library functions
  24554. that need to pass file names to DOS.  `_put_path' copies its argument
  24555. PATH to the "transfer buffer" (*note _go32_info_block::.) starting at
  24556. the beginning of the transfer buffer; `_put_path2' does the same except
  24557. that it puts the file name starting at OFFSET bytes from the beginning
  24558. of the transfer buffer.
  24559.  
  24560. These functions are meant to be called by low-level library functions,
  24561. not by applications.  You should only call them if you know what you are
  24562. doing.  In particular, if you call any library function between a call
  24563. to `_put_path' or `_put_path2' and the call to a DOS function that uses
  24564. the file name, the file name in the transfer buffer could be wiped out,
  24565. corrupted or otherwise changed.  You *have* been warned!
  24566.  
  24567. Some constructs in file names are transformed while copying them, to
  24568. allow transparent support for nifty features.  Here's the list of these
  24569. transformations:
  24570.  
  24571.    * Multiple forward slashes are collapsed into a single slash.
  24572.  
  24573.      Unix treats multiple slashes as a single slash, so some ported
  24574.      programs pass names like `c:/foo//bar' to library functions.  DOS
  24575.      functions choke on such file names, so collapsing the slashes
  24576.      prevents these names from failing.
  24577.  
  24578.    * Trailing slashes are removed, except for root directories.
  24579.  
  24580.      Various DOS calls cannot cope with file names like `c:/foo/'; this
  24581.      feature solves this problem.
  24582.  
  24583.    * Translation of Unix device names.
  24584.  
  24585.      Unix `/dev/null' is mapped to DOS-standard `NUL', and Unix
  24586.      `/dev/tty' to DOS-standard `CON'.  This provides for transparent
  24587.      support of these special devices, e.g. in Unix shell scripts.
  24588.  
  24589.    * Translation of DOS device names.
  24590.  
  24591.      Any file name which begins with `/dev/' or `X:/dev/' (where X: is
  24592.      any valid DOS drive letter) has the `/dev/' or `X:/dev/' prefix
  24593.      removed, and the rest is passed to DOS.  This is because some DOS
  24594.      functions don't recognize device names unless they are devoid of
  24595.      the drive and directory specifications, and programs could add a
  24596.      drive and a directory if they convert a name like `/dev/con' to a
  24597.      fully-qualified path name.
  24598.  
  24599.    * `/dev/x/' is translated into `x:/'.
  24600.  
  24601.      This allows to use Unix-style absolute path names that begin with a
  24602.      slash, instead of DOS-style names with a drive letter.  Some Unix
  24603.      programs and shell scripts fail for file names that include colons,
  24604.      which are part of the drive letter specification; this feature
  24605.      allows to work around such problems by using e.g. `/dev/c/' where
  24606.      `c:/' would fail.
  24607.  
  24608.    * `/dev/env/FOO/' is replaced by the value of the environment
  24609.      variable FOO.
  24610.  
  24611.      (In other words, you can think of environment variables as if they
  24612.      were sub-directories of a fictitious directory `/dev/env'.)
  24613.  
  24614.      This allows to use environment variable names inside path names
  24615.      compiled into programs, and have them transparently expanded at
  24616.      run time.  For example, `/dev/env/DJDIR/include' will expand to
  24617.      the exact path name of the DJGPP include directory, no matter
  24618.      where DJGPP is installed on the machine where the program runs.
  24619.      (The value of `DJDIR' is computed by the DJGPP startup code and
  24620.      pushed into the environment of every DJGPP program before `main'
  24621.      is called.)
  24622.  
  24623.      Note that environment variables are case-sensitive, so
  24624.      `/dev/env/foo' and `/dev/env/FOO' are *not* the same.  DOS shells
  24625.      usually upcase the name of the environment variable if you set it
  24626.      with the built-in command `SET', so if you type e.g. `SET
  24627.      foo=bar', the shell defines a variable named `FOO'.
  24628.  
  24629.      If the environment variable is undefined, it will expand into an
  24630.      empty string.  The expansion is done recursively, so environment
  24631.      variables may reference other environment variables using the same
  24632.      `/dev/env/' notation.  For example, if the variable `HOME' is set
  24633.      to `/dev/env/DJDIR/home', and DJGPP is installed in
  24634.      `c:/software/djgpp', then `/dev/env/HOME/sources' will expand to
  24635.      `c:/software/djgpp/home/sources'.
  24636.  
  24637.      It is possible to supply a default value, to be used if the
  24638.      variable is not defined, or has an empty value.  To this end, put
  24639.      the default value after the name of the variable and delimit it by
  24640.      `~', like in `/dev/env/DJDIR~c:/djgpp~/include'.
  24641.  
  24642.      If you need to include a literal character `~' in either the
  24643.      environment variable name or in the default value that replaces
  24644.      it, use two `~'s in a row.  For example, `/dev/env/FOO~~' will
  24645.      expand to the value of the variable `FOO~'.  Likewise,
  24646.      `/dev/env/FOO~~BAR~foo~~baz~' will expand to the value of the
  24647.      variable `FOO~BAR' if it is defined and nonempty, and to `foo~baz'
  24648.      otherwise.  Leading `~' in the default value isn't supported (it
  24649.      is interpreted as part of the preceding variable name).
  24650.  
  24651.      The default value may also reference (other) environment
  24652.      variables, but nested default values can get tricky.  For example,
  24653.      `/dev/env/foo~/dev/env/bar~' will work, but
  24654.      `/dev/env/foo~/dev/env/bar~baz~~' will *not*.  To use nested
  24655.      default values, you need to double the quoting of the `~'
  24656.      characters, like in `/dev/env/foo~/dev/env/bar~~baz~~~'.
  24657.  
  24658. Return Value
  24659. ------------
  24660.  
  24661. Both functions return the offset into the transfer buffer of the
  24662. terminating null character that ends the file name.
  24663.  
  24664. not ANSI, not POSIX
  24665.  
  24666. Example
  24667. -------
  24668.  
  24669. These functions are meant to be called by low-level library functions,
  24670. not by applications.  You should only call them if you know what you are
  24671. doing.  In particular, if you call any library function between a call
  24672. to `_put_path' or `_put_path2' and the call to a DOS function that uses
  24673. the file name, the file name in the transfer buffer could be wiped out,
  24674. corrupted and otherwise changed.  You *have* been warned!
  24675.  
  24676.       __dpmi_regs r;
  24677.      
  24678.       _put_path("/dev/c/djgpp/bin/");
  24679.       r.x.ax = 0x4300;  /* get file attributes */
  24680.       r.x.ds = __tb >> 4;
  24681.       r.x.dx = __tb & 0x0f;
  24682.       __dpmi_int(0x21, &r);
  24683.  
  24684. 
  24685. File: libc.info,  Node: putc,  Next: putch,  Prev: _put_path,  Up: Alphabetical List
  24686.  
  24687. putc
  24688. ====
  24689.  
  24690. Syntax
  24691. ------
  24692.  
  24693.      #include <stdio.h>
  24694.      
  24695.      int putc(int c, FILE *file);
  24696.  
  24697. Description
  24698. -----------
  24699.  
  24700. This function writes one character to the given FILE.
  24701.  
  24702. Return Value
  24703. ------------
  24704.  
  24705. The character written.
  24706.  
  24707. Portability
  24708. -----------
  24709.  
  24710. ANSI, POSIX
  24711.  
  24712. Example
  24713. -------
  24714.  
  24715.      while ((c=getc(stdin)) != EOF)
  24716.        putc(c, stdout);
  24717.  
  24718. 
  24719. File: libc.info,  Node: putch,  Next: putchar,  Prev: putc,  Up: Alphabetical List
  24720.  
  24721. putch
  24722. =====
  24723.  
  24724. Syntax
  24725. ------
  24726.  
  24727.      #include <conio.h>
  24728.      
  24729.      int putch(int _c);
  24730.  
  24731. Description
  24732. -----------
  24733.  
  24734. Put the character _C on the screen at the current cursor position.  The
  24735. special characters return, linefeed, bell, and backspace are handled
  24736. properly, as is line wrap and scrolling.  The cursor position is
  24737. updated.
  24738.  
  24739. Return Value
  24740. ------------
  24741.  
  24742. The character is returned.
  24743.  
  24744. Portability
  24745. -----------
  24746.  
  24747. not ANSI, not POSIX
  24748.  
  24749. 
  24750. File: libc.info,  Node: putchar,  Next: putenv,  Prev: putch,  Up: Alphabetical List
  24751.  
  24752. putchar
  24753. =======
  24754.  
  24755. Syntax
  24756. ------
  24757.  
  24758.      #include <stdio.h>
  24759.      
  24760.      int putchar(int c);
  24761.  
  24762. Description
  24763. -----------
  24764.  
  24765. This is the same as `fputc(c, stdout)'.  *Note fputc::.
  24766.  
  24767. Return Value
  24768. ------------
  24769.  
  24770. The character written.
  24771.  
  24772. Portability
  24773. -----------
  24774.  
  24775. ANSI, POSIX
  24776.  
  24777. Example
  24778. -------
  24779.  
  24780.      while ((c = getchar()) != EOF)
  24781.        putchar(c);
  24782.  
  24783. 
  24784. File: libc.info,  Node: putenv,  Next: puts,  Prev: putchar,  Up: Alphabetical List
  24785.  
  24786. putenv
  24787. ======
  24788.  
  24789. Syntax
  24790. ------
  24791.  
  24792.      #include <stdlib.h>
  24793.      
  24794.      int putenv(const char *env);
  24795.  
  24796. Description
  24797. -----------
  24798.  
  24799. This function adds an entry to the program's environment.  The string
  24800. passed must be of the form `NAME'=`VALUE'.  Any existing value for the
  24801. environment variable is gone.
  24802.  
  24803. `putenv' will copy the string passed to it, and will automatically free
  24804. any existing string already in the environment.  Keep this in mind if
  24805. you alter the environment yourself.  The string you pass is still your
  24806. responsibility to free.  Note that most implementations will not let
  24807. you free the string you pass, resulting in memory leaks.
  24808.  
  24809. Return Value
  24810. ------------
  24811.  
  24812. Zero on success, nonzero on failure.
  24813.  
  24814. Portability
  24815. -----------
  24816.  
  24817. not ANSI, not POSIX
  24818.  
  24819. Example
  24820. -------
  24821.  
  24822.      putenv("SHELL=ksh.exe");
  24823.  
  24824. 
  24825. File: libc.info,  Node: puts,  Next: puttext,  Prev: putenv,  Up: Alphabetical List
  24826.  
  24827. puts
  24828. ====
  24829.  
  24830. Syntax
  24831. ------
  24832.  
  24833.      #include <stdio.h>
  24834.      
  24835.      int puts(const char *string);
  24836.  
  24837. Description
  24838. -----------
  24839.  
  24840. This function writes STRING to `stdout', and then writes a newline
  24841. character.
  24842.  
  24843. Return Value
  24844. ------------
  24845.  
  24846. Nonnegative for success, or `EOF' on error.
  24847.  
  24848. Portability
  24849. -----------
  24850.  
  24851. ANSI, POSIX
  24852.  
  24853. Example
  24854. -------
  24855.  
  24856.      puts("Hello, there");
  24857.  
  24858. 
  24859. File: libc.info,  Node: puttext,  Next: putw,  Prev: puts,  Up: Alphabetical List
  24860.  
  24861. puttext
  24862. =======
  24863.  
  24864. Syntax
  24865. ------
  24866.  
  24867.      #include <conio.h>
  24868.      
  24869.      int puttext(int _left, int _top, int _right, int _bottom, void *_source);
  24870.  
  24871. Description
  24872. -----------
  24873.  
  24874. The opposite of *Note gettext::.
  24875.  
  24876. Return Value
  24877. ------------
  24878.  
  24879. 1 on success, zero on error.
  24880.  
  24881. Portability
  24882. -----------
  24883.  
  24884. not ANSI, not POSIX
  24885.  
  24886. 
  24887. File: libc.info,  Node: putw,  Next: qsort,  Prev: puttext,  Up: Alphabetical List
  24888.  
  24889. putw
  24890. ====
  24891.  
  24892. Syntax
  24893. ------
  24894.  
  24895.      #include <stdio.h>
  24896.      
  24897.      int putw(int x, FILE *file);
  24898.  
  24899. Description
  24900. -----------
  24901.  
  24902. Writes a single binary word in native format to FILE.
  24903.  
  24904. Return Value
  24905. ------------
  24906.  
  24907. The value written, or `EOF' for end-of-file or error.  Since `EOF' is a
  24908. valid integer, you should use `feof' or `ferror' to detect this
  24909. situation.
  24910.  
  24911. Portability
  24912. -----------
  24913.  
  24914. not ANSI, not POSIX
  24915.  
  24916. Example
  24917. -------
  24918.  
  24919.      putw(12, stdout);
  24920.  
  24921. 
  24922. File: libc.info,  Node: qsort,  Next: raise,  Prev: putw,  Up: Alphabetical List
  24923.  
  24924. qsort
  24925. =====
  24926.  
  24927. Syntax
  24928. ------
  24929.  
  24930.      #include <stdlib.h>
  24931.      
  24932.      void qsort(void *base, size_t numelem, size_t size,
  24933.                 int (*cmp)(const void *e1, const void *e2));
  24934.  
  24935. Description
  24936. -----------
  24937.  
  24938. This function sorts the given array in place.  BASE is the address of
  24939. the first of NUMELEM array entries, each of size SIZE bytes.  `qsort'
  24940. uses the supplied function CMP to determine the sort order for any two
  24941. elements by passing the address of the two elements and using the
  24942. function's return address.
  24943.  
  24944. The return address of the function indicates the sort order:
  24945.  
  24946. Negative
  24947.      Element E1 should come before element E2 in the resulting array.
  24948.  
  24949. Positive
  24950.      Element E1 should come after element E2 in the resulting array.
  24951.  
  24952. Zero
  24953.      It doesn't matter which element comes first in the resulting array.
  24954.  
  24955. Return Value
  24956. ------------
  24957.  
  24958. None.
  24959.  
  24960. Portability
  24961. -----------
  24962.  
  24963. ANSI, POSIX
  24964.  
  24965. Example
  24966. -------
  24967.  
  24968.      typedef struct {
  24969.        int size;
  24970.        int sequence;
  24971.      } Item;
  24972.      
  24973.      int qsort_helper_by_size(const void *e1, const void *e2)
  24974.      {
  24975.        return ((const Item *)e2)->size - ((const Item *)e1)->size;
  24976.      }
  24977.      
  24978.      Item list[100];
  24979.      
  24980.      qsort(list, 100, sizeof(Item), qsort_helper_by_size);
  24981.      
  24982.      int qsort_stringlist(const void *e1, const void *e2)
  24983.      {
  24984.        return strcmp(*(char **)e1, *(char **)e2);
  24985.      }
  24986.      
  24987.      char *slist[10];
  24988.      
  24989.      /* alphabetical order */
  24990.      qsort(slist, 10, sizeof(char *), qsort_stringlist);
  24991.  
  24992. 
  24993. File: libc.info,  Node: raise,  Next: rand,  Prev: qsort,  Up: Alphabetical List
  24994.  
  24995. raise
  24996. =====
  24997.  
  24998. Syntax
  24999. ------
  25000.  
  25001.      #include <signal.h>
  25002.      
  25003.      int    raise(int sig);
  25004.  
  25005. Description
  25006. -----------
  25007.  
  25008. This function raises the given signal SIG.  *Note the list of possible
  25009. signals: signal.
  25010.  
  25011. Return Value
  25012. ------------
  25013.  
  25014. 0 on success, -1 for illegal value of SIG.
  25015.  
  25016. Portability
  25017. -----------
  25018.  
  25019. ANSI, POSIX
  25020.  
  25021. 
  25022. File: libc.info,  Node: rand,  Next: rand48,  Prev: raise,  Up: Alphabetical List
  25023.  
  25024. rand
  25025. ====
  25026.  
  25027. Syntax
  25028. ------
  25029.  
  25030.      #include <stdlib.h>
  25031.      
  25032.      int rand(void);
  25033.  
  25034. Description
  25035. -----------
  25036.  
  25037. Returns a pseudo-random number between zero and `RAND_MAX' (defined on
  25038. `stdlib.h').
  25039.  
  25040. By default, this function always generates the same sequence of numbers
  25041. each time you run the program.  (This is usually desirable when
  25042. debugging, or when comparing two different runs.)  If you need to
  25043. produce a different sequence on every run, you must seed `rand' by
  25044. calling `srand' (*note srand::.) before the first call to `rand', and
  25045. make sure to use a different argument to `srand' each time.  The usual
  25046. technique is to get the argument to `srand' from a call to the `time'
  25047. library function (*note time::.), whose return value changes every
  25048. second.
  25049.  
  25050. To get a random number in the range 0..N, use `rand()%(N+1)'.  Note
  25051. that the low bits of the `rand''s return value are not very random, so
  25052. `rand()%N' for small values of N could be not enough random.  The
  25053. alternative, but non-ANSI, function `random' is better if N is small.
  25054. *Note random::.
  25055.  
  25056. Return Value
  25057. ------------
  25058.  
  25059. The number.
  25060.  
  25061. Portability
  25062. -----------
  25063.  
  25064. ANSI, POSIX
  25065.  
  25066. Example
  25067. -------
  25068.  
  25069.      /* random pause */
  25070.      srand(time(0));
  25071.      for (i=rand(); i; i--);
  25072.  
  25073. 
  25074. File: libc.info,  Node: rand48,  Next: random,  Prev: rand,  Up: Alphabetical List
  25075.  
  25076. rand48
  25077. ======
  25078.  
  25079. Syntax
  25080. ------
  25081.  
  25082.      #include <stdlib.h>
  25083.      
  25084.      double drand48(void);
  25085.      double erand48(unsigned short state[3]);
  25086.      unsigned long lrand48(void);
  25087.      unsigned long nrand48(unsigned short state[3]);
  25088.      long mrand48(void);
  25089.      long jrand48(unsigned short state[3]);
  25090.      void srand48(long seed);
  25091.      unsigned short *seed48(unsigned short state_seed[3]);
  25092.      void lcong48(unsigned short param[7]);
  25093.  
  25094. Description
  25095. -----------
  25096.  
  25097. This is the family of `*rand48' functions.  The basis for these
  25098. functions is the linear congruential formula X[n+1] = (a*X[n] + c) mod
  25099. 2^48, n >= 0.  a = 0x5deece66d and c = 0xb at start and after a call to
  25100. either `srand48' or `seed48'.  A call to `lcong48' changes a and c (and
  25101. the internal state).
  25102.  
  25103. `drand48' and `erand48' return `double's uniformly distributed in the
  25104. interval [0.0, 1.0).
  25105.  
  25106. `lrand48' and `nrand48' return `unsigned long's uniformly distributed
  25107. in the interval [0, 2^31).
  25108.  
  25109. `mrand48' and `jrand48' return `long's uniformly distributed in the
  25110. interval [-2^31, 2^31).
  25111.  
  25112. `erand48', `jrand48' and `nrand48' requires the state of the random
  25113. generator to be passed.
  25114.  
  25115. `drand48', `lrand48' and `mrand48' uses an internal state (common with
  25116. all three functions) which should be initialized with a call to one of
  25117. the functions `srand48', `seed48' or `lcong48'.
  25118.  
  25119. `srand48' sets the high order 32 bits to the argument SEED.  The low
  25120. order 16 bits are set to the arbitrary value 0x330e.
  25121.  
  25122. `seed48' sets the internal state according to the argument STATE_SEED
  25123. (`STATE_SEED[0]' is least significant).  The previous state of the
  25124. random generator is saved in an internal (static) buffer, to which a
  25125. pointer is returned.
  25126.  
  25127. `lcong48' sets the internal state to `PARAM[0-2]', a to `PARAM[3-5]'
  25128. (`PARAM[0]' and `PARAM[3]' are least significant) and c to `PARAM[6]'.
  25129.  
  25130. Return Value
  25131. ------------
  25132.  
  25133. A random number.
  25134.  
  25135. Portability
  25136. -----------
  25137.  
  25138. not ANSI, not POSIX
  25139.  
  25140. Example
  25141. -------
  25142.  
  25143.      #include <stdio.h>
  25144.      #include <stdlib.h>
  25145.      #include <time.h>
  25146.      
  25147.      int main(void)
  25148.      {
  25149.      
  25150.        srand48(time(NULL));
  25151.        printf("%.12f is a random number in [0.0, 1.0).\n", drand48());
  25152.      
  25153.        exit(0);
  25154.      }
  25155.  
  25156. 
  25157. File: libc.info,  Node: random,  Next: rawclock,  Prev: rand48,  Up: Alphabetical List
  25158.  
  25159. random
  25160. ======
  25161.  
  25162. Syntax
  25163. ------
  25164.  
  25165.      #include <stdlib.h>
  25166.      
  25167.      long random(void);
  25168.  
  25169. Description
  25170. -----------
  25171.  
  25172. Returns a random number in the range 0..MAXINT.
  25173.  
  25174. Return Value
  25175. ------------
  25176.  
  25177. 0 .. MAXINT
  25178.  
  25179. Portability
  25180. -----------
  25181.  
  25182. not ANSI, not POSIX
  25183.  
  25184. Example
  25185. -------
  25186.  
  25187.       /* Produce a random integer between 0 and 199.  */
  25188.       int random_number = random () % 200;
  25189.  
  25190. 
  25191. File: libc.info,  Node: rawclock,  Next: read,  Prev: random,  Up: Alphabetical List
  25192.  
  25193. rawclock
  25194. ========
  25195.  
  25196. Syntax
  25197. ------
  25198.  
  25199.      #include <time.h>
  25200.      
  25201.      unsigned long rawclock(void);
  25202.  
  25203. Description
  25204. -----------
  25205.  
  25206. Returns the number of clock tics (18.2 per second) since midnight.
  25207.  
  25208. Return Value
  25209. ------------
  25210.  
  25211. The number of tics.
  25212.  
  25213. Portability
  25214. -----------
  25215.  
  25216. not ANSI, not POSIX
  25217.  
  25218. Example
  25219. -------
  25220.  
  25221.      /* wait 1/4 second */
  25222.      int i = rawclock()+5;
  25223.      while (rawclock()<i);
  25224.  
  25225. 
  25226. File: libc.info,  Node: read,  Next: _read,  Prev: rawclock,  Up: Alphabetical List
  25227.  
  25228. read
  25229. ====
  25230.  
  25231. Syntax
  25232. ------
  25233.  
  25234.      #include <unistd.h>
  25235.      
  25236.      ssize_t read(int fd, void *buffer, size_t length);
  25237.  
  25238. Description
  25239. -----------
  25240.  
  25241. This function reads at most LENGTH bytes from file FD into BUFFER.
  25242. Note that in some cases, such as end-of-file conditions and text files,
  25243. it may read less than the requested number of bytes.  At end-of-file,
  25244. `read' will read exactly zero bytes.
  25245.  
  25246. Return Value
  25247. ------------
  25248.  
  25249. The number of bytes read, zero meaning end-of-file, or -1 for an error.
  25250.  
  25251. Portability
  25252. -----------
  25253.  
  25254. not ANSI, POSIX
  25255.  
  25256. Example
  25257. -------
  25258.  
  25259.      char buf[10];
  25260.      int r = read(0, buf, 10);
  25261.  
  25262. 
  25263. File: libc.info,  Node: _read,  Next: read_child,  Prev: read,  Up: Alphabetical List
  25264.  
  25265. _read
  25266. =====
  25267.  
  25268. Syntax
  25269. ------
  25270.  
  25271.      #include <io.h>
  25272.      
  25273.      ssize_t _read(int fildes, void *buf, size_t nbyte);
  25274.  
  25275. Description
  25276. -----------
  25277.  
  25278. This is a direct connection to the MS-DOS read function call, int 0x21,
  25279. %ah = 0x3f.  No conversion is done on the data; it is read as raw
  25280. binary data. This function can be hooked by the *Note File System
  25281. Extensions::. If you don't want this, you should use *Note _dos_read::.
  25282.  
  25283. Return Value
  25284. ------------
  25285.  
  25286. The number of bytes read.
  25287.  
  25288. Portability
  25289. -----------
  25290.  
  25291. not ANSI, not POSIX
  25292.  
  25293. 
  25294. File: libc.info,  Node: read_child,  Next: read_sel_addr,  Prev: _read,  Up: Alphabetical List
  25295.  
  25296. read_child
  25297. ==========
  25298.  
  25299. Syntax
  25300. ------
  25301.  
  25302.      #include <debug/dbgcom.h>
  25303.      
  25304.      void read_child (unsigned child_addr, void *buf, unsigned len);
  25305.  
  25306. Description
  25307. -----------
  25308.  
  25309. This function reads the memory of the debugged process starting at
  25310. address CHILD_ADDR for LEN bytes, and copies the data read to the
  25311. buffer pointed to by BUF.  It is used primarily to save the original
  25312. instruction at the point where a breakpoint instruction is inserted (to
  25313. trigger a trap when the debuggee's code gets to that point).  *Note
  25314. write_child::.
  25315.  
  25316. Return Value
  25317. ------------
  25318.  
  25319. The function return zero if it has successfully transferred the data,
  25320. non-zero otherwise (e.g., if the address in CHILD_ADDR is outside the
  25321. limits of the debuggee's code segment.
  25322.  
  25323. Portability
  25324. -----------
  25325.  
  25326. not ANSI, not POSIX
  25327.  
  25328. 
  25329. File: libc.info,  Node: read_sel_addr,  Next: readdir,  Prev: read_child,  Up: Alphabetical List
  25330.  
  25331. read_sel_addr
  25332. =============
  25333.  
  25334. Syntax
  25335. ------
  25336.  
  25337.      #include <debug/dbgcom.h>
  25338.      
  25339.      void read_sel_addr (unsigned offset, void *buf, unsigned len, unsigned sel);
  25340.  
  25341. Description
  25342. -----------
  25343.  
  25344. This function reads the memory starting at offset OFFSET in selector
  25345. SEL for LEN bytes, and copies the data read to the buffer pointed to by
  25346. BUF.  *Note write_sel_addr::.
  25347.  
  25348. Return Value
  25349. ------------
  25350.  
  25351. The function return zero if it has successfully transferred the data,
  25352. non-zero otherwise (e.g., if the address in OFFSET is outside the
  25353. limits of the segment whose selector is SEL).
  25354.  
  25355. Portability
  25356. -----------
  25357.  
  25358. not ANSI, not POSIX
  25359.  
  25360. 
  25361. File: libc.info,  Node: readdir,  Next: realloc,  Prev: read_sel_addr,  Up: Alphabetical List
  25362.  
  25363. readdir
  25364. =======
  25365.  
  25366. Syntax
  25367. ------
  25368.  
  25369.      #include <dirent.h>
  25370.      
  25371.      struct dirent *readdir(DIR *dir);
  25372.  
  25373. Description
  25374. -----------
  25375.  
  25376. This function reads entries from a directory opened by `opendir' (*note
  25377. opendir::.).  It returns the information in a static buffer with this
  25378. format:
  25379.  
  25380.      struct dirent {
  25381.        unsigned short d_namlen;  /* The length of the name (like strlen) */
  25382.        char d_name[MAXNAMLEN+1]; /* The name */
  25383.      };
  25384.  
  25385. Note that some directory entries might be skipped by `readdir',
  25386. depending on the bits set in the global variable `__opendir_flags'.
  25387. *Note __opendir_flags: opendir.
  25388.  
  25389. Return Value
  25390. ------------
  25391.  
  25392. A pointer to a static buffer that is overwritten with each call.
  25393.  
  25394. Portability
  25395. -----------
  25396.  
  25397. not ANSI, POSIX (see note 1)
  25398.  
  25399. Notes:
  25400.  
  25401.   1. The `__opendir_flags' variable is DJGPP-specific.
  25402.  
  25403. Example
  25404. -------
  25405.  
  25406.      DIR *d = opendir(".");
  25407.      struct dirent *de;
  25408.      while (de = readdir(d))
  25409.        puts(de->d_name);
  25410.      closedir(d);
  25411.  
  25412. 
  25413. File: libc.info,  Node: realloc,  Next: redir_cmdline_delete,  Prev: readdir,  Up: Alphabetical List
  25414.  
  25415. realloc
  25416. =======
  25417.  
  25418. Syntax
  25419. ------
  25420.  
  25421.      #include <stdlib.h>
  25422.      
  25423.      void *realloc(void *ptr, size_t size);
  25424.  
  25425. Description
  25426. -----------
  25427.  
  25428. This function changes the size of the region pointed to by PTR.  If it
  25429. can, it will reuse the same memory space, but it may have to allocate a
  25430. new memory space to satisfy the request.  In either case, it will
  25431. return the pointer that you should use to refer to the (possibly new)
  25432. memory area.  The pointer passed may be `NULL', in which case this
  25433. function acts just like `malloc' (*note malloc::.).
  25434.  
  25435. Return Value
  25436. ------------
  25437.  
  25438. A pointer to the memory you should now refer to.
  25439.  
  25440. Portability
  25441. -----------
  25442.  
  25443. ANSI, POSIX
  25444.  
  25445. Example
  25446. -------
  25447.  
  25448.      if (now+new > max)
  25449.      {
  25450.        max = now+new;
  25451.        p = realloc(p, max);
  25452.      }
  25453.  
  25454. 
  25455. File: libc.info,  Node: redir_cmdline_delete,  Next: redir_cmdline_parse,  Prev: realloc,  Up: Alphabetical List
  25456.  
  25457. redir_cmdline_delete
  25458. ====================
  25459.  
  25460. Syntax
  25461. ------
  25462.  
  25463.      #include <debug/redir.h>
  25464.      
  25465.      void redir_cmdline_delete (cmdline_t *cmd);
  25466.  
  25467. Description
  25468. -----------
  25469.  
  25470. For the rationale and general description of the debugger redirection
  25471. issue, see *Note redir_debug_init::.
  25472.  
  25473. This function serves as a destructor for a `cmdline_t' object.  It
  25474. frees storage used for the command-line arguments associated with CMD,
  25475. closes any open handles stored in it, and frees memory used to store
  25476. the file handles and the file names of the files where standard handles
  25477. were redirected.
  25478.  
  25479. The function is safe to use even if CMD might be a `NULL' pointer, or
  25480. if some of members of the `cmdline_t' structure are `NULL' pointers.
  25481. *Note redir_debug_init::, for detailed description of the `cmdline_t'
  25482. structure.
  25483.  
  25484. Portability
  25485. -----------
  25486.  
  25487. not ANSI, not POSIX
  25488.  
  25489. Example
  25490. -------
  25491.  
  25492.       redir_cmdline_delete (&child_cmd);
  25493.  
  25494. 
  25495. File: libc.info,  Node: redir_cmdline_parse,  Next: redir_debug_init,  Prev: redir_cmdline_delete,  Up: Alphabetical List
  25496.  
  25497. redir_cmdline_parse
  25498. ===================
  25499.  
  25500. Syntax
  25501. ------
  25502.  
  25503.      #include <debug/redir.h>
  25504.      
  25505.      int  redir_cmdline_parse (const char *args, cmdline_t *cmd);
  25506.  
  25507. Description
  25508. -----------
  25509.  
  25510. For the rationale and general description of the debugger redirection
  25511. issue, see *Note redir_debug_init::.
  25512.  
  25513. This function parses a command-line tail (i.e., without the program to
  25514. be invoked) passed as a string in ARGS.  For every redirection
  25515. directive in ARGS, like `>> foo', it opens the file that is the target
  25516. of the redirection, and records in CMD the information about these
  25517. redirections.  (*Note redir_debug_init::, for details of the
  25518. `cmdline_t' structure that is used to hold this information.)  The
  25519. command line with redirections removed is placed into `cmd->command'
  25520. (typically, it will be used to call `v2loadimage', *note
  25521. v2loadimage::.), while the rest of information is used by
  25522. `redir_to_child' and `redir_to_debugger' to redirect standard handles
  25523. before and after calling `run_child'.
  25524.  
  25525. Return Value
  25526. ------------
  25527.  
  25528. The function returns zero in case of success, -1 otherwise.  Failure
  25529. usually means some kind of syntax error, like `>' without a file name
  25530. following it; or a file name that isn't allowed by the underlying OS,
  25531. like `lost+found' on DOS.
  25532.  
  25533. Portability
  25534. -----------
  25535.  
  25536. not ANSI, not POSIX
  25537.  
  25538. Example
  25539. -------
  25540.  
  25541.        /* Init command line storage.  */
  25542.        if (redir_debug_init (&child_cmd) == -1)
  25543.          fatal ("Cannot allocate redirection storage: not enough memory.\n");
  25544.      
  25545.        /* Parse the command line and create redirections.  */
  25546.        if (strpbrk (args, "<>"))
  25547.          {
  25548.            if (redir_cmdline_parse (args, &child_cmd) == 0)
  25549.          args = child_cmd.command;
  25550.            else
  25551.          error ("Syntax error in command line.");
  25552.          }
  25553.        else
  25554.          child_cmd.command = strdup (args);
  25555.      
  25556.        cmdline = (char *) alloca (strlen (args) + 4);
  25557.        cmdline[0] = strlen (args);
  25558.        strcpy (cmdline + 1, args);
  25559.        cmdline[strlen (args) + 1] = 13;
  25560.      
  25561.        if (v2loadimage (exec_file, cmdline, start_state))
  25562.          {
  25563.            printf ("Load failed for image %s\n", exec_file);
  25564.            exit (1);
  25565.          }
  25566.  
  25567. 
  25568. File: libc.info,  Node: redir_debug_init,  Next: redir_to_child,  Prev: redir_cmdline_parse,  Up: Alphabetical List
  25569.  
  25570. redir_debug_init
  25571. ================
  25572.  
  25573. Syntax
  25574. ------
  25575.  
  25576.      #include <debug/redir.h>
  25577.      
  25578.      int redir_debug_init (cmdline_t *cmd);
  25579.  
  25580. Description
  25581. -----------
  25582.  
  25583. This function initializes the data structure in the CMD variable
  25584. required to save and restore debugger's standard handles across
  25585. invocations of `run_child' (*note run_child::.).  The debugger will
  25586. then typically call `redir_to_child' and `redir_to_debugger'.
  25587.  
  25588. These functions are needed when a debugger wants to redirect standard
  25589. handles of the debuggee, or if the debuggee redirects some of its
  25590. standard handles, because the debuggee is not a separate process, we
  25591. just pretend it is by jumping between two threads of execution.  But, as
  25592. far as DOS is concerned, the debugger and the debuggee are a single
  25593. process, and they share the same "Job File Table" (JFT).  The JFT is a
  25594. table maintained by DOS in the program's PSP where, for each open
  25595. handle, DOS stores the index into the SFT, the "System File Table".
  25596. (The SFT is an internal data structure where DOS maintains everything it
  25597. knows about a certain open file/device.)  A handle that is returned by
  25598. `open', `_open' and other similar functions is simply an index into the
  25599. JFT where DOS stored the SFT entry index for the file or device that
  25600. the program opened.
  25601.  
  25602. When a program starts, the first 5 entries in the JFT are preconnected
  25603. to the standard devices.  Any additional handles opened by either the
  25604. debugger or the debuggee use handles beyond the first 5 (unless one of
  25605. the preconnected handles is deliberately closed).  Here we mostly deal
  25606. with handles 0, 1 and 2, the standard input, standard output, and
  25607. standard error; they all start connected to the console device (unless
  25608. somebody redirects the debugger's I/O from the command line).
  25609.  
  25610. Since both the debugger and the debuggee share the same JFT, their
  25611. handles 0, 1 and 2 point to the same JFT entries and thus are connected
  25612. to the same files/devices.  Therefore, if the debugger redirects its
  25613. standard output, the standard output of the debuggee is also
  25614. automagically redirected to the same file/device!  Similarly, if the
  25615. debuggee redirects its stdout to a file, you won't be able to see
  25616. debugger's output (it will go to the same file where the debuggee has
  25617. its output); and if the debuggee closes its standard input, you will
  25618. lose the ability to talk to debugger!
  25619.  
  25620. The debugger redirection support attempts to solve all these problems by
  25621. creating an illusion of two separate sets of standard handles.  Each
  25622. time the debuggee is about to be run or resumed, it should call
  25623. `redir_to_child' to redirect debugger's own standard handles to the
  25624. file specified in the command-line (as given by e.g. the "run" command
  25625. of GDB) before running the debuggee, then call `redir_to_debugger' to
  25626. redirect them back to the debugger's original input/output when the
  25627. control is returned from the debuggee (e.g. after a breakpoint is hit).
  25628. Although the debugger and the debuggee have two separate copies of the
  25629. file-associated data structures, the debugger still can redirect
  25630. standard handles of the debuggee because they use the same JFT entries
  25631. as debugger's own standard handles.
  25632.  
  25633. The `cmdline_t' structure is declared in the header `debug/redir.h' as
  25634. follows:
  25635.  
  25636.      struct dbg_redirect {
  25637.        int inf_handle;   /* debuggee's handle */
  25638.        int our_handle;   /* debugger's handle */
  25639.        char *file_name;  /* file name where debuggee's handle is redirected */
  25640.        int mode;         /* mode used to open() the above file */
  25641.        off_t filepos;    /* file position of debuggee's handle; unused */
  25642.      };
  25643.      
  25644.      typedef struct _cmdline {
  25645.        char *command;            /* command line with redirection removed */
  25646.        int redirected;            /* 1 if handles redirected for child */
  25647.        struct dbg_redirect **redirection;/* info about redirected handles */
  25648.      } cmdline_t;
  25649.  
  25650. In the `cmdline_t' structure, the `redirection' member points to an
  25651. array of 3 `dbg_redirect' structures, one each for each one of the 3
  25652. standard handles.  The `inf_handle' and `our_handle' members of those
  25653. structures are used to save the handle used, respectively, by the
  25654. debuggee (a.k.a. "the inferior process") and by the debugger.
  25655.  
  25656. The CMD variable is supposed to be defined by the debugger's
  25657. application code.  `redir_debug_init' is called to initialize that
  25658. variable.  It calls `redir_cmdline_delete' to close any open handles
  25659. held in CMD and to free any allocated storage; then it fills CMD with
  25660. the trivial information (i.e., every standard stream is connected to
  25661. the usual handles 0, 1, and 2).
  25662.  
  25663. Return Value
  25664. ------------
  25665.  
  25666. `redir_debug_init' returns zero in case of success, or -1 otherwise.
  25667.  
  25668. Portability
  25669. -----------
  25670.  
  25671. not ANSI, not POSIX
  25672.  
  25673. Example
  25674. -------
  25675.  
  25676.       if (redir_debug_init (&child_cmd) == -1)
  25677.         fatal ("Cannot allocate redirection storage: not enough memory.\n");
  25678.  
  25679. 
  25680. File: libc.info,  Node: redir_to_child,  Next: redir_to_debugger,  Prev: redir_debug_init,  Up: Alphabetical List
  25681.  
  25682. redir_to_child
  25683. ==============
  25684.  
  25685. Syntax
  25686. ------
  25687.  
  25688.      #include <debug/redir.h>
  25689.      
  25690.      int redir_to_child (cmdline_t *cmd);
  25691.  
  25692. Description
  25693. -----------
  25694.  
  25695. For the rationale and general description of the debugger redirection
  25696. issue, see *Note redir_debug_init::.
  25697.  
  25698. This function redirects all 3 standard streams so that they point to the
  25699. files/devices where the child (a.k.a. debuggee) process connected them.
  25700. All three standard handles point to the console device by default, but
  25701. this could be changed, either because the command line for the child
  25702. requested redirection, like in `prog > foo', or because the child
  25703. program itself redirected one of its standard handles e.g. with a call
  25704. to `dup2'.
  25705.  
  25706. `redir_to_child' uses information stored in the `cmdline_t' variable
  25707. pointed to by the CMD argument to redirect the standard streams as
  25708. appropriate for the debuggee, while saving the original debugger's
  25709. handles to be restored by `redir_to_debugger'.
  25710.  
  25711. Return Value
  25712. ------------
  25713.  
  25714. The function returns zero in case of success, -1 in case of failure.
  25715. Failure usually means the process has run out of available file handles.
  25716.  
  25717. Portability
  25718. -----------
  25719.  
  25720. not ANSI, not POSIX
  25721.  
  25722. Example
  25723. -------
  25724.  
  25725.        errno = 0;
  25726.        if (redir_to_child (&child_cmd) == -1)
  25727.          {
  25728.            redir_to_debugger (&child_cmd);
  25729.            error ("Cannot redirect standard handles for program: %s.",
  25730.                   strerror (errno));
  25731.          }
  25732.  
  25733. 
  25734. File: libc.info,  Node: redir_to_debugger,  Next: regcomp,  Prev: redir_to_child,  Up: Alphabetical List
  25735.  
  25736. redir_to_debugger
  25737. =================
  25738.  
  25739. Syntax
  25740. ------
  25741.  
  25742.      #include <debug/redir.h>
  25743.      
  25744.      int redir_to_debugger (cmdline_t *cmd);
  25745.  
  25746. Description
  25747. -----------
  25748.  
  25749. For the rationale and general description of the debugger redirection
  25750. issue, see *Note redir_debug_init::.
  25751.  
  25752. This function redirects all 3 standard streams so that they point to the
  25753. files/devices where the debugger process connected them.  All three
  25754. standard handles point to the console device by default, but this could
  25755. be changed, either because the command line for the child requested
  25756. redirection, like in `prog > foo', or because the child program itself
  25757. redirected one of its standard handles e.g. with a call to `dup2'.
  25758.  
  25759. `redir_to_debugger' uses information stored in the `cmdline_t' variable
  25760. pointed to by the CMD argument to redirect the standard streams as
  25761. appropriate for the debugger, while saving the original debuggee's
  25762. handles to be restored by `redir_to_child'.
  25763.  
  25764. Return Value
  25765. ------------
  25766.  
  25767. The function returns zero in case of success, -1 in case of failure.
  25768. Failure usually means the process has run out of available file handles.
  25769.  
  25770. Portability
  25771. -----------
  25772.  
  25773. not ANSI, not POSIX
  25774.  
  25775. Example
  25776. -------
  25777.  
  25778.       /* Restore debugger's standard handles.  */
  25779.       errno = 0;
  25780.       if (redir_to_debugger (&child_cmd) == -1)
  25781.         error ("Cannot redirect standard handles for debugger: %s.",
  25782.                strerror (errno));
  25783.  
  25784. 
  25785. File: libc.info,  Node: regcomp,  Next: regerror,  Prev: redir_to_debugger,  Up: Alphabetical List
  25786.  
  25787. regcomp
  25788. =======
  25789.  
  25790. Syntax
  25791. ------
  25792.  
  25793.      #include <sys/types.h>
  25794.      #include <regex.h>
  25795.      
  25796.      int regcomp(regex_t *preg, const char *pattern, int cflags);
  25797.  
  25798. Description
  25799. -----------
  25800.  
  25801. This function is part of the implementation of POSIX 1003.2 regular
  25802. expressions ("RE"s).
  25803.  
  25804. `regcomp' compiles the regular expression contained in the PATTERN
  25805. string, subject to the flags in CFLAGS, and places the results in the
  25806. `regex_t' structure pointed to by PREG.  (The regular expression
  25807. syntax, as defined by POSIX 1003.2, is described below.)
  25808.  
  25809. The parameter CFLAGS is the bitwise OR of zero or more of the following
  25810. flags:
  25811.  
  25812. `REG_EXTENDED'
  25813.      Compile modern ("extended") REs, rather than the obsolete
  25814.      ("basic") REs that are the default.
  25815.  
  25816. `REG_BASIC'
  25817.      This is a synonym for 0, provided as a counterpart to
  25818.      `REG_EXTENDED' to improve readability.  This is an extension,
  25819.      compatible with but not specified by POSIX 1003.2, and should be
  25820.      used with caution in software intended to be portable to other
  25821.      systems.
  25822.  
  25823. `REG_NOSPEC'
  25824.      Compile with recognition of all special characters turned off.  All
  25825.      characters are thus considered ordinary, so the RE in PATTERN is a
  25826.      literal string.  This is an extension, compatible with but not
  25827.      specified by POSIX 1003.2, and should be used with caution in
  25828.      software intended to be portable to other systems.  `REG_EXTENDED'
  25829.      and `REG_NOSPEC' may not be used in the same call to `regcomp'.
  25830.  
  25831. `REG_ICASE'
  25832.      Compile for matching that ignores upper/lower case distinctions.
  25833.      See the description of regular expressions below for details of
  25834.      case-independent matching.
  25835.  
  25836. `REG_NOSUB'
  25837.      Compile for matching that need only report success or failure, not
  25838.      what was matched.
  25839.  
  25840. `REG_NEWLINE'
  25841.      Compile for newline-sensitive matching.  By default, newline is a
  25842.      completely ordinary character with no special meaning in either
  25843.      REs or strings.  With this flag, `[^' bracket expressions and `.'
  25844.      never match newline, a `^' anchor matches the null string after any
  25845.      newline in the string in addition to its normal function, and the
  25846.      `$' anchor matches the null string before any newline in the string
  25847.      in addition to its normal function.
  25848.  
  25849. `REG_PEND'
  25850.      The regular expression ends, not at the first NUL, but just before
  25851.      the character pointed to by the `re_endp' member of the structure
  25852.      pointed to by PREG.  The `re_endp' member is of type `const char
  25853.      *'.  This flag permits inclusion of NULs in the RE; they are
  25854.      considered ordinary characters.  This is an extension, compatible
  25855.      with but not specified by POSIX 1003.2, and should be used with
  25856.      caution in software intended to be portable to other systems.
  25857.  
  25858. When successful, `regcomp' returns 0 and fills in the structure pointed
  25859. to by PREG.  One member of that structure (other than `re_endp') is
  25860. publicized: `re_nsub', of type `size_t', contains the number of
  25861. parenthesized subexpressions within the RE (except that the value of
  25862. this member is undefined if the `REG_NOSUB' flag was used).
  25863.  
  25864. Note that the length of the RE does matter; in particular, there is a
  25865. strong speed bonus for keeping RE length under about 30 characters,
  25866. with most special characters counting roughly double.
  25867.  
  25868. Return Value
  25869. ------------
  25870.  
  25871. If `regcomp' succeeds, it returns zero; if it fails, it returns a
  25872. non-zero error code, which is one of these:
  25873.  
  25874. `REG_BADPAT'
  25875.      invalid regular expression
  25876.  
  25877. `REG_ECOLLATE'
  25878.      invalid collating element
  25879.  
  25880. `REG_ECTYPE'
  25881.      invalid character class
  25882.  
  25883. `REG_EESCAPE'
  25884.      `\' applied to unescapable character
  25885.  
  25886. `REG_ESUBREG'
  25887.      invalid backreference number (e.g., larger than the number of
  25888.      parenthesized subexpressions in the RE)
  25889.  
  25890. `REG_EBRACK'
  25891.      brackets [ ] not balanced
  25892.  
  25893. `REG_EPAREN'
  25894.      parentheses ( ) not balanced
  25895.  
  25896. `REG_EBRACE'
  25897.      braces { } not balanced
  25898.  
  25899. `REG_BADBR'
  25900.      invalid repetition count(s) in { }
  25901.  
  25902. `REG_ERANGE'
  25903.      invalid character range in [ ]
  25904.  
  25905. `REG_ESPACE'
  25906.      ran out of memory (an RE like, say,
  25907.      `((((a{1,100}){1,100}){1,100}){1,100}){1,100}'' will eventually
  25908.      run almost any existing machine out of swap space)
  25909.  
  25910. `REG_BADRPT'
  25911.      ?, *, or + operand invalid
  25912.  
  25913. `REG_EMPTY'
  25914.      empty (sub)expression
  25915.  
  25916. `REG_ASSERT'
  25917.      "can't happen" (you found a bug in `regcomp')
  25918.  
  25919. `REG_INVARG'
  25920.      invalid argument (e.g. a negative-length string)
  25921.  
  25922. Regular Expressions' Syntax
  25923. ---------------------------
  25924.  
  25925. Regular expressions ("RE"s), as defined in POSIX 1003.2, come in two
  25926. forms: modern REs (roughly those of `egrep'; 1003.2 calls these
  25927. *extended* REs) and obsolete REs (roughly those of `ed'; 1003.2 *basic*
  25928. REs).  Obsolete REs mostly exist for backward compatibility in some old
  25929. programs; they will be discussed at the end.  1003.2 leaves some
  25930. aspects of RE syntax and semantics open; `(*)' marks decisions on these
  25931. aspects that may not be fully portable to other 1003.2 implementations.
  25932.  
  25933. A (modern) RE is one(*) or more non-empty(*) *branches*, separated by
  25934. `|'.  It matches anything that matches one of the branches.
  25935.  
  25936. A branch is one(*) or more *pieces*, concatenated.  It matches a match
  25937. for the first, followed by a match for the second, etc.
  25938.  
  25939. A piece is an *atom* possibly followed by a single(*) `*', `+', `?', or
  25940. *bound*.  An atom followed by `*' matches a sequence of 0 or more
  25941. matches of the atom.  An atom followed by `+' matches a sequence of 1
  25942. or more matches of the atom.  An atom followed by `?' matches a
  25943. sequence of 0 or 1 matches of the atom.
  25944.  
  25945. A *bound* is `{' followed by an unsigned decimal integer, possibly
  25946. followed by `,' possibly followed by another unsigned decimal integer,
  25947. always followed by `}'.  The integers must lie between 0 and
  25948. `RE_DUP_MAX' (255(*)) inclusive, and if there are two of them, the
  25949. first may not exceed the second.  An atom followed by a bound
  25950. containing one integer `i' and no comma matches a sequence of exactly
  25951. `i' matches of the atom.  An atom followed by a bound containing one
  25952. integer `i' and a comma matches a sequence of `i' or more matches of
  25953. the atom.  An atom followed by a bound containing two integers `i' and
  25954. `j' matches a sequence of `i' through `j' (inclusive) matches of the
  25955. atom.
  25956.  
  25957. An atom is a regular expression enclosed in `()' (matching a match for
  25958. the regular expression), an empty set of `()' (matching the null
  25959. string(*)), a *bracket expression* (see below), `.'  (matching any
  25960. single character), `^' (matching the null string at the beginning of a
  25961. line), `$' (matching the null string at the end of a line), a `\'
  25962. followed by one of the characters `^.[$()|*+?{\\' (matching that
  25963. character taken as an ordinary character), a `\' followed by any other
  25964. character(*) (matching that character taken as an ordinary character,
  25965. as if the `\' had not been present(*)), or a single character with no
  25966. other significance (matching that character).  A `{' followed by a
  25967. character other than a digit is an ordinary character, not the
  25968. beginning of a bound(*).  It is illegal to end an RE with `\'.
  25969.  
  25970. A *bracket expression* is a list of characters enclosed in `[]'.  It
  25971. normally matches any single character from the list (but see below).
  25972. If the list begins with `^', it matches any single character (but see
  25973. below) *not* from the rest of the list.  If two characters in the list
  25974. are separated by `-', this is shorthand for the full *range* of
  25975. characters between those two (inclusive) in the collating sequence,
  25976. e.g. `[0-9]' in ASCII matches any decimal digit.  It is illegal(*) for
  25977. two ranges to share an endpoint, e.g. `a-c-e'.  Ranges are very
  25978. collating-sequence-dependent, and portable programs should avoid
  25979. relying on them.
  25980.  
  25981. To include a literal `]' in the list, make it the first character
  25982. (following a possible `^').  To include a literal `-', make it the
  25983. first or last character, or the second endpoint of a range.  To use a
  25984. literal `-' as the first endpoint of a range, enclose it in `[.' and
  25985. `.]' to make it a collating element (see below).  With the exception of
  25986. these and some combinations using `[' (see next paragraphs), all other
  25987. special characters, including `\', lose their special significance
  25988. within a bracket expression.
  25989.  
  25990. Within a bracket expression, a collating element (a character, a
  25991. multi-character sequence that collates as if it were a single character,
  25992. or a collating-sequence name for either) enclosed in `[.' and `.]'
  25993. stands for the sequence of characters of that collating element.  The
  25994. sequence is a single element of the bracket expression's list.  A
  25995. bracket expression containing a multi-character collating element can
  25996. thus match more than one character, e.g. if the collating sequence
  25997. includes a `ch' collating element, then the RE `[[.ch.]]*c' matches the
  25998. first five characters of "chchcc".
  25999.  
  26000. Within a bracket expression, a collating element enclosed in `[=' and
  26001. `=]' is an equivalence class, standing for the sequences of characters
  26002. of all collating elements equivalent to that one, including itself.
  26003. (If there are no other equivalent collating elements, the treatment is
  26004. as if the enclosing delimiters were `[.' and `.]'.)  For example, if
  26005. `o' and `^' are the members of an equivalence class, then `[[=o=]]',
  26006. `[[=^=]]', and `[o^]' are all synonymous.  An equivalence class may
  26007. *not* be an endpoint of a range.
  26008.  
  26009. Within a bracket expression, the name of a *character class* enclosed
  26010. in `[:' and `:]' stands for the list of all characters belonging to
  26011. that class.  Standard character class names are:
  26012.  
  26013.      alnum    digit    punct
  26014.      alpha    graph    space
  26015.      blank    lower    upper
  26016.      cntrl    print    xdigit
  26017.  
  26018. These stand for the character classes defined by `isalnum' (*note
  26019. isalnum::.), `isdigit' (*note isdigit::.), `ispunct' (*note
  26020. ispunct::.), `isalpha' (*note isalpha::.), `isgraph' (*note
  26021. isgraph::.), `isspace' (*note isspace::.) (`blank' is the same as
  26022. `space'), `islower' (*note islower::.), `isupper' (*note isupper::.),
  26023. `iscntrl' (*note iscntrl::.), `isprint' (*note isprint::.), and
  26024. `isxdigit' (*note isxdigit::.), respectively.  A locale may provide
  26025. others.  A character class may not be used as an endpoint of a range.
  26026.  
  26027. There are two special cases(*) of bracket expressions: the bracket
  26028. expressions `[[:<:]]' and `[[:>:]]' match the null string at the
  26029. beginning and end of a word respectively.  A word is defined as a
  26030. sequence of word characters which is neither preceded nor followed by
  26031. word characters.  A word character is an `alnum' character (as defined
  26032. by `isalnum' library function) or an underscore.  This is an extension,
  26033. compatible with but not specified by POSIX 1003.2, and should be used
  26034. with caution in software intended to be portable to other systems.
  26035.  
  26036. In the event that an RE could match more than one substring of a given
  26037. string, the RE matches the one starting earliest in the string.  If the
  26038. RE could match more than one substring starting at that point, it
  26039. matches the longest.  Subexpressions also match the longest possible
  26040. substrings, subject to the constraint that the whole match be as long as
  26041. possible, with subexpressions starting earlier in the RE taking priority
  26042. over ones starting later.  Note that higher-level subexpressions thus
  26043. take priority over their lower-level component subexpressions.
  26044.  
  26045. Match lengths are measured in characters, not collating elements.  A
  26046. null string is considered longer than no match at all.  For example,
  26047. `bb*' matches the three middle characters of "abbbc",
  26048. `(wee|week)(knights|nights)' matches all ten characters of
  26049. "weeknights", when `(.*).*' is matched against "abc" the parenthesized
  26050. subexpression matches all three characters, and when `(a*)*' is matched
  26051. against "bc" both the whole RE and the parenthesized subexpression
  26052. match the null string.
  26053.  
  26054. If case-independent matching is specified, the effect is much as if all
  26055. case distinctions had vanished from the alphabet.  When an alphabetic
  26056. that exists in multiple cases appears as an ordinary character outside a
  26057. bracket expression, it is effectively transformed into a bracket
  26058. expression containing both cases, e.g. `x' becomes `[xX]'.  When it
  26059. appears inside a bracket expression, all case counterparts of it are
  26060. added to the bracket expression, so that (e.g.) `[x]' becomes `[xX]'
  26061. and `[^x]' becomes `[^xX]'.
  26062.  
  26063. No particular limit is imposed on the length of REs(*).  Programs
  26064. intended to be portable should not employ REs longer than 256 bytes, as
  26065. an implementation can refuse to accept such REs and remain
  26066. POSIX-compliant.
  26067.  
  26068. Obsolete (*basic*) regular expressions differ in several respects.
  26069. `|', `+', and `?' are ordinary characters and there is no equivalent
  26070. for their functionality.  The delimiters for bounds are `\{' and `\}',
  26071. with `{' and `}' by themselves ordinary characters.  The parentheses
  26072. for nested subexpressions are `\(' and `\)', with `(' and `)' by
  26073. themselves ordinary characters.  `^' is an ordinary character except at
  26074. the beginning of the RE or(*) the beginning of a parenthesized
  26075. subexpression, `$' is an ordinary character except at the end of the RE
  26076. or(*) the end of a parenthesized subexpression, and `*' is an ordinary
  26077. character if it appears at the beginning of the RE or the beginning of
  26078. a parenthesized subexpression (after a possible leading `^').  Finally,
  26079. there is one new type of atom, a *back reference*: `\' followed by a
  26080. non-zero decimal digit *d* matches the same sequence of characters
  26081. matched by the *d*th parenthesized subexpression (numbering
  26082. subexpressions by the positions of their opening parentheses, left to
  26083. right), so that (e.g.)  `\([bc]\)\1' matches "bb" or "cc" but not "bc".
  26084.  
  26085. History
  26086. -------
  26087.  
  26088. This implementation of the POSIX regexp functionality was written by
  26089. Henry Spencer <henry@zoo.toronto.edu>.
  26090.  
  26091. Bugs
  26092. ----
  26093.  
  26094. The locale is always assumed to be the default one of 1003.2, and only
  26095. the collating elements etc. of that locale are available.
  26096.  
  26097. `regcomp' implements bounded repetitions by macro expansion, which is
  26098. costly in time and space if counts are large or bounded repetitions are
  26099. nested.
  26100.  
  26101. An RE like, say, `((((a{1,100}){1,100}){1,100}){1,100}){1,100}', will
  26102. (eventually) run almost any existing machine out of swap space.
  26103.  
  26104. There are suspected problems with response to obscure error conditions.
  26105. Notably, certain kinds of internal overflow, produced only by truly
  26106. enormous REs or by multiply nested bounded repetitions, are probably not
  26107. handled well.
  26108.  
  26109. Due to a mistake in 1003.2, things like `a)b' are legal REs because `)'
  26110. is a special character only in the presence of a previous unmatched
  26111. `('.  This can't be fixed until the spec is fixed.
  26112.  
  26113. The standard's definition of back references is vague.  For example,
  26114. does `a\e(\e(b\e)*\e2\e)*d' match "abbbd"?  Until the standard is
  26115. clarified, behavior in such cases should not be relied on.
  26116.  
  26117. Portability
  26118. -----------
  26119.  
  26120. not ANSI, POSIX
  26121.  
  26122. 
  26123. File: libc.info,  Node: regerror,  Next: regexec,  Prev: regcomp,  Up: Alphabetical List
  26124.  
  26125. regerror
  26126. ========
  26127.  
  26128. Syntax
  26129. ------
  26130.  
  26131.  
  26132.      #include <sys/types.h>
  26133.      #include <regex.h>
  26134.      
  26135.      size_t regerror(int errcode, const regex_t *preg,
  26136.                      char *errbuf, size_t errbuf_size);
  26137.  
  26138. Description
  26139. -----------
  26140.  
  26141. `regerror' maps a non-zero value of ERRCODE from either `regcomp'
  26142. (Return Value, *note regcomp::.) or `regexec' (Return Value, *note
  26143. regexec::.) to a human-readable, printable message.
  26144.  
  26145. If PREG is non-`NULL', the error code should have arisen from use of
  26146. the variable of the type `regex_t' pointed to by PREG, and if the error
  26147. code came from `regcomp', it should have been the result from the most
  26148. recent `regcomp' using that `regex_t' variable.  (`regerror' may be
  26149. able to supply a more detailed message using information from the
  26150. `regex_t' than from ERRCODE alone.)  `regerror' places the
  26151. `NUL'-terminated message into the buffer pointed to by ERRBUF, limiting
  26152. the length (including the `NUL') to at most ERRBUF_SIZE bytes.  If the
  26153. whole message won't fit, as much of it as will fit before the
  26154. terminating `NUL' is supplied.  In any case, the returned value is the
  26155. size of buffer needed to hold the whole message (including terminating
  26156. `NUL').  If ERRBUF_SIZE is 0, ERRBUF is ignored but the return value is
  26157. still correct.
  26158.  
  26159. If the ERRCODE given to `regerror' is first ORed with `REG_ITOA', the
  26160. "message" that results is the printable name of the error code, e.g.
  26161. "REG_NOMATCH", rather than an explanation thereof.  If ERRCODE is
  26162. `REG_ATOI', then PREG shall be non-NULL and the `re_endp' member of the
  26163. structure it points to must point to the printable name of an error code
  26164. (e.g. "REG_ECOLLATE"); in this case, the result in ERRBUF is the
  26165. decimal representation of the numeric value of the error code (0 if the
  26166. name is not recognized).  `REG_ITOA' and `REG_ATOI' are intended
  26167. primarily as debugging facilities; they are extensions, compatible with
  26168. but not specified by POSIX 1003.2, and should be used with caution in
  26169. software intended to be portable to other systems.  Be warned also that
  26170. they are considered experimental and changes are possible.
  26171.  
  26172. Return Value
  26173. ------------
  26174.  
  26175. The size of buffer needed to hold the message (including terminating
  26176. `NUL') is always returned, even if ERRBUF_SIZE is zero.
  26177.  
  26178. Portability
  26179. -----------
  26180.  
  26181. not ANSI, POSIX
  26182.  
  26183. 
  26184. File: libc.info,  Node: regexec,  Next: regfree,  Prev: regerror,  Up: Alphabetical List
  26185.  
  26186. regexec
  26187. =======
  26188.  
  26189. Syntax
  26190. ------
  26191.  
  26192.      #include <sys/types.h>
  26193.      #include <regex.h>
  26194.      
  26195.      int regexec(const regex_t *preg, const char *string,
  26196.                  size_t nmatch, regmatch_t pmatch[], int eflags);
  26197.  
  26198. Description
  26199. -----------
  26200.  
  26201. `regexec' matches the compiled RE pointed to by PREG against the
  26202. STRING, subject to the flags in EFLAGS, and reports results using
  26203. NMATCH, PMATCH, and the returned value.  The RE must have been compiled
  26204. by a previous invocation of `regcomp' (*note regcomp::.).  The compiled
  26205. form is not altered during execution of `regexec', so a single compiled
  26206. RE can be used simultaneously by multiple threads.
  26207.  
  26208. By default, the NUL-terminated string pointed to by STRING is
  26209. considered to be the text of an entire line, with the NUL indicating the
  26210. end of the line.  (That is, any other end-of-line marker is considered
  26211. to have been removed and replaced by the NUL.)
  26212.  
  26213. The EFLAGS argument is the bitwise OR of zero or more of the following
  26214. flags:
  26215.  
  26216. `REG_NOTBOL'
  26217.      The first character of the string is not the beginning of a line,
  26218.      so the `^' anchor should not match before it.  This does not
  26219.      affect the behavior of newlines under `REG_NEWLINE' (REG_NEWLINE,
  26220.      *note regcomp::.).
  26221.  
  26222. `REG_NOTEOL'
  26223.      The NUL terminating the string does not end a line, so the `$'
  26224.      anchor should not match before it.  This does not affect the
  26225.      behavior of newlines under `REG_NEWLINE' (REG_NEWLINE, *note
  26226.      regcomp::.).
  26227.  
  26228. `REG_STARTEND'
  26229.      The string is considered to start at `STRING + PMATCH[0].rm_so'
  26230.      and to have a terminating `NUL' located at
  26231.      `STRING + PMATCH[0].rm_eo' (there need not actually be a `NUL' at
  26232.      that location), regardless of the value of NMATCH.  See below for
  26233.      the definition of PMATCH and NMATCH.  This is an extension,
  26234.      compatible with but not specified by POSIX 1003.2, and should be
  26235.      used with caution in software intended to be portable to other
  26236.      systems.  Note that a non-zero `rm_so' does not imply
  26237.      `REG_NOTBOL'; `REG_STARTEND' affects only the location of the
  26238.      string, not how it is matched.
  26239.  
  26240. `REG_TRACE'
  26241.      trace execution (printed to stdout)
  26242.  
  26243. `REG_LARGE'
  26244.      force large representation
  26245.  
  26246. `REG_BACKR'
  26247.      force use of backref code
  26248.  
  26249. Regular Expressions' Syntax, *Note regcomp::, for a discussion of what
  26250. is matched in situations where an RE or a portion thereof could match
  26251. any of several substrings of STRING.
  26252.  
  26253. If `REG_NOSUB' was specified in the compilation of the RE (REG_NOSUB,
  26254. *note regcomp::.), or if NMATCH is 0, `regexec' ignores the PMATCH
  26255. argument (but see below for the case where `REG_STARTEND' is
  26256. specified).  Otherwise, PMATCH should point to an array of NMATCH
  26257. structures of type `regmatch_t'.  Such a structure has at least the
  26258. members `rm_so' and `rm_eo', both of type `regoff_t' (a signed
  26259. arithmetic type at least as large as an `off_t' and a `ssize_t',
  26260. containing respectively the offset of the first character of a
  26261. substring and the offset of the first character after the end of the
  26262. substring.  Offsets are measured from the beginning of the STRING
  26263. argument given to `regexec'.  An empty substring is denoted by equal
  26264. offsets, both indicating the character following the empty substring.
  26265.  
  26266. When `regexec' returns, the 0th member of the PMATCH array is filled in
  26267. to indicate what substring of STRING was matched by the entire RE.
  26268. Remaining members report what substring was matched by parenthesized
  26269. subexpressions within the RE; member `i' reports subexpression `i',
  26270. with subexpressions counted (starting at 1) by the order of their
  26271. opening parentheses in the RE, left to right.  Unused entries in the
  26272. array--corresponding either to subexpressions that did not participate
  26273. in the match at all, or to subexpressions that do not exist in the RE
  26274. (that is, `i > preg->re_nsub'--have both `rm_so' and `rm_eo' set to
  26275. `-1'.  If a subexpression participated in the match several times, the
  26276. reported substring is the last one it matched.  (Note, as an example in
  26277. particular, that when the RE `(b*)+' matches "bbb", the parenthesized
  26278. subexpression matches the three `b's and then an infinite number of
  26279. empty strings following the last `b', so the reported substring is one
  26280. of the empties.)
  26281.  
  26282. If `REG_STARTEND' is specified in EFLAGS, PMATCH must point to at least
  26283. one `regmatch_t' variable (even if NMATCH is 0 or `REG_NOSUB' was
  26284. specified in the compilation of the RE, REG_NOSUB, *note regcomp::.),
  26285. to hold the input offsets for `REG_STARTEND'.  Use for output is still
  26286. entirely controlled by NMATCH; if NMATCH is 0 or `REG_NOSUB' was
  26287. specified, the value of `pmatch[0]' will not be changed by a successful
  26288. `regexec'.
  26289.  
  26290. Return Value
  26291. ------------
  26292.  
  26293. Normally, `regexec' returns 0 for success and the non-zero code
  26294. `REG_NOMATCH' for failure.  Other non-zero error codes may be returned
  26295. in exceptional situations.  The list of possible error return values is
  26296. below:
  26297.  
  26298. `REG_ESPACE'
  26299.      ran out of memory
  26300.  
  26301. `REG_BADPAT'
  26302.      the passed argument PREG doesn't point to an RE compiled by
  26303.      `regcomp'
  26304.  
  26305. `REG_INVARG'
  26306.      invalid argument(s) (e.g., `STRING + PMATCH[0].rm_eo' is less than
  26307.      `STRING + PMATCH[0].rm_so')
  26308.  
  26309. History
  26310. -------
  26311.  
  26312. This implementation of the POSIX regexp functionality was written by
  26313. Henry Spencer <henry@zoo.toronto.edu>.
  26314.  
  26315. Bugs
  26316. ----
  26317.  
  26318. `regexec' performance is poor.  NMATCH exceeding 0 is expensive; NMATCH
  26319. exceeding 1 is worse.  `regexec' is largely insensitive to RE
  26320. complexity *except* that back references are massively expensive.  RE
  26321. length does matter; in particular, there is a strong speed bonus for
  26322. keeping RE length under about 30 characters, with most special
  26323. characters counting roughly double.
  26324.  
  26325. The implementation of word-boundary matching is a bit of a kludge, and
  26326. bugs may lurk in combinations of word-boundary matching and anchoring.
  26327.  
  26328. Portability
  26329. -----------
  26330.  
  26331. not ANSI, POSIX
  26332.  
  26333. 
  26334. File: libc.info,  Node: regfree,  Next: remove,  Prev: regexec,  Up: Alphabetical List
  26335.  
  26336. regfree
  26337. =======
  26338.  
  26339. Syntax
  26340. ------
  26341.  
  26342.  
  26343.      #include <sys/types.h>
  26344.      #include <regex.h>
  26345.      
  26346.      void regfree(regex_t *preg);
  26347.  
  26348. Description
  26349. -----------
  26350.  
  26351. `regfree' frees any dynamically-allocated storage associated with the
  26352. compiled RE pointed to by PREG.  The remaining `regex_t' is no longer a
  26353. valid compiled RE and the effect of supplying it to `regexec' or
  26354. `regerror' is undefined.
  26355.  
  26356. Portability
  26357. -----------
  26358.  
  26359. not ANSI, POSIX
  26360.  
  26361. 
  26362. File: libc.info,  Node: remove,  Next: remque,  Prev: regfree,  Up: Alphabetical List
  26363.  
  26364. remove
  26365. ======
  26366.  
  26367. Syntax
  26368. ------
  26369.  
  26370.      #include <stdio.h>
  26371.      
  26372.      int remove(const char *file);
  26373.  
  26374. Description
  26375. -----------
  26376.  
  26377. This function removes the named FILE from the file system.  Unless you
  26378. have an un-erase program, the file and its contents are gone for good.
  26379.  
  26380. Return Value
  26381. ------------
  26382.  
  26383. Zero on success, nonzero on failure.
  26384.  
  26385. Portability
  26386. -----------
  26387.  
  26388. ANSI, POSIX
  26389.  
  26390. Example
  26391. -------
  26392.  
  26393.      remove("/tmp/data.tmp");
  26394.  
  26395. 
  26396. File: libc.info,  Node: remque,  Next: _rename,  Prev: remove,  Up: Alphabetical List
  26397.  
  26398. remque
  26399. ======
  26400.  
  26401. Syntax
  26402. ------
  26403.  
  26404.      #include <search.h>
  26405.      
  26406.      void remque(struct qelem *elem);
  26407.  
  26408. Description
  26409. -----------
  26410.  
  26411. This function manipulates queues built from doubly linked lists.  Each
  26412. element in the queue must be in the form of `struct qelem' which is
  26413. defined thus:
  26414.  
  26415.      struct qelem {
  26416.        struct qelem *q_forw;
  26417.        struct qelem *q_back;
  26418.        char q_data[0];
  26419.      }
  26420.  
  26421. This function removes the entry ELEM from a queue.
  26422.  
  26423. Return Value
  26424. ------------
  26425.  
  26426. None.
  26427.  
  26428. Portability
  26429. -----------
  26430.  
  26431. not ANSI, not POSIX
  26432.  
  26433. 
  26434. File: libc.info,  Node: _rename,  Next: rename,  Prev: remque,  Up: Alphabetical List
  26435.  
  26436. _rename
  26437. =======
  26438.  
  26439. Syntax
  26440. ------
  26441.  
  26442.      #include <stdio.h>
  26443.      
  26444.      int _rename(const char *oldname, const char *newname);
  26445.  
  26446. Description
  26447. -----------
  26448.  
  26449. This function renames an existing file or directory OLDNAME to NEWNAME.
  26450. It is much smaller that `rename' (*note rename::.), but it can only
  26451. rename a directory so it stays under the same parent, it cannot move
  26452. directories between different branches of the directory tree.  This
  26453. means that in the following example, the first call will succeed, while
  26454. the second will fail:
  26455.  
  26456.      _rename("c:/path1/mydir", "c:/path1/yourdir");
  26457.      _rename("c:/path1/mydir", "c:/path2");
  26458.  
  26459. On systems that support long filenames (*note _use_lfn::.), `_rename'
  26460. can also move directories (so that both calls in the above example
  26461. succeed there), unless the `LFN' environment variable is set to `n', or
  26462. the `_CRT0_FLAG_NO_LFN' is set in the `_crt0_startup_flags' variable,
  26463. *Note _crt0_startup_flags::.
  26464.  
  26465. If you don't need the extra functionality offered by `rename' (which
  26466. usually is only expected by Unix-born programs), you can use `_rename'
  26467. instead and thus make your program a lot smaller.
  26468.  
  26469. Return Value
  26470. ------------
  26471.  
  26472. Zero on success, nonzero on failure.
  26473.  
  26474. Portability
  26475. -----------
  26476.  
  26477. not ANSI, not POSIX
  26478.  
  26479. 
  26480. File: libc.info,  Node: rename,  Next: rewind,  Prev: _rename,  Up: Alphabetical List
  26481.  
  26482. rename
  26483. ======
  26484.  
  26485. Syntax
  26486. ------
  26487.  
  26488.      #include <stdio.h>
  26489.      
  26490.      int rename(const char *oldname, const char *newname);
  26491.  
  26492. Description
  26493. -----------
  26494.  
  26495. This function renames an existing file or directory OLDNAME to NEWNAME.
  26496. If NEWNAME exists, then it is first removed.  If NEWNAME is a
  26497. directory, it must be empty (or else ERRNO will be set to `ENOTEMPTY'),
  26498. and must not include OLDNAME in its path prefix (otherwise, ERRNO will
  26499. be set to `EINVAL').  If NEWNAME exists, both OLDNAME and NEWNAME must
  26500. be of the same type (both directories or both regular files) (or else
  26501. ERRNO will be set to `ENOTDIR' or `EISDIR'), and must reside on the
  26502. same logical device (otherwise, ERRNO will be set to `EXDEV').
  26503. Wildcards are not allowed in either OLDNAME or NEWNAME.  DOS won't
  26504. allow renaming a current directory even on a non-default drive (you
  26505. will get the `EBUSY' or `EINVAL' in ERRNO).  `ENAMETOOLONG' will be
  26506. returned for pathnames which are longer than the limit imposed by DOS.
  26507. If OLDNAME doesn't exist, ERRNO will be set to `ENOENT'.  For most of
  26508. the other calamities, DOS will usually set ERRNO to `EACCES'.
  26509.  
  26510. If anything goes wrong during the operation of `rename()', the function
  26511. tries very hard to leave the things as ther were before it was invoked,
  26512. but it might not always succeed.
  26513.  
  26514. Return Value
  26515. ------------
  26516.  
  26517. Zero on success, nonzero on failure.
  26518.  
  26519. Portability
  26520. -----------
  26521.  
  26522. ANSI, POSIX
  26523.  
  26524. Example
  26525. -------
  26526.  
  26527.      rename("c:/mydir/some.doc", "c:/yourdir/some.sav");
  26528.      rename("c:/path1/mydir", "c:/path2");
  26529.  
  26530. 
  26531. File: libc.info,  Node: rewind,  Next: rewinddir,  Prev: rename,  Up: Alphabetical List
  26532.  
  26533. rewind
  26534. ======
  26535.  
  26536. Syntax
  26537. ------
  26538.  
  26539.      #include <stdio.h>
  26540.      
  26541.      void rewind(FILE *file);
  26542.  
  26543. Description
  26544. -----------
  26545.  
  26546. This function repositions the file pointer to the beginning of the file
  26547. and clears the error indicator.
  26548.  
  26549. Return Value
  26550. ------------
  26551.  
  26552. None.
  26553.  
  26554. Portability
  26555. -----------
  26556.  
  26557. ANSI, POSIX
  26558.  
  26559. Example
  26560. -------
  26561.  
  26562.      rewind(stdin);
  26563.  
  26564. 
  26565. File: libc.info,  Node: rewinddir,  Next: rindex,  Prev: rewind,  Up: Alphabetical List
  26566.  
  26567. rewinddir
  26568. =========
  26569.  
  26570. Syntax
  26571. ------
  26572.  
  26573.      #include <dirent.h>
  26574.      
  26575.      void rewinddir(DIR *dir);
  26576.  
  26577. Description
  26578. -----------
  26579.  
  26580. This function resets the position of the DIR so that the next call to
  26581. `readdir' (*note readdir::.) starts at the beginning again.
  26582.  
  26583. Return Value
  26584. ------------
  26585.  
  26586. None.
  26587.  
  26588. Portability
  26589. -----------
  26590.  
  26591. not ANSI, POSIX
  26592.  
  26593. Example
  26594. -------
  26595.  
  26596.      DIR *d = opendir(".");
  26597.      rewinddir(d);
  26598.  
  26599. 
  26600. File: libc.info,  Node: rindex,  Next: rmdir,  Prev: rewinddir,  Up: Alphabetical List
  26601.  
  26602. rindex
  26603. ======
  26604.  
  26605. Syntax
  26606. ------
  26607.  
  26608.      #include <strings.h>
  26609.      
  26610.      char *rindex(const char *string, int ch);
  26611.  
  26612. Description
  26613. -----------
  26614.  
  26615. Returns a pointer to the last occurrence of CH in STRING.  Note that
  26616. the `NULL' character counts, so if you pass zero as CH you'll get a
  26617. pointer to the end of the string back.
  26618.  
  26619. Return Value
  26620. ------------
  26621.  
  26622. A pointer to the character, or `NULL' if it wasn't found.
  26623.  
  26624. Portability
  26625. -----------
  26626.  
  26627. not ANSI, not POSIX
  26628.  
  26629. Example
  26630. -------
  26631.  
  26632.      char *last_slash = rindex(filename, '/');
  26633.  
  26634. 
  26635. File: libc.info,  Node: rmdir,  Next: run_child,  Prev: rindex,  Up: Alphabetical List
  26636.  
  26637. rmdir
  26638. =====
  26639.  
  26640. Syntax
  26641. ------
  26642.  
  26643.      #include <unistd.h>
  26644.      
  26645.      int rmdir(const char *dirname);
  26646.  
  26647. Description
  26648. -----------
  26649.  
  26650. This function removes directory DIRNAME.  The directory must be empty.
  26651.  
  26652. Return Value
  26653. ------------
  26654.  
  26655. Zero if the directory was removed, nonzero on failure.
  26656.  
  26657. Portability
  26658. -----------
  26659.  
  26660. not ANSI, POSIX
  26661.  
  26662. Example
  26663. -------
  26664.  
  26665.      rmdir("/tmp/datadir");
  26666.  
  26667. 
  26668. File: libc.info,  Node: run_child,  Next: save_npx,  Prev: rmdir,  Up: Alphabetical List
  26669.  
  26670. run_child
  26671. =========
  26672.  
  26673. Syntax
  26674. ------
  26675.  
  26676.      #include <debug/dbgcom.h>
  26677.      
  26678.      void run_child (void);
  26679.  
  26680. Description
  26681. -----------
  26682.  
  26683. This function starts or resumes the debugged program, via a `longjmp'
  26684. to the debuggee's code.  When the debuggee hits a breakpoint, or exits
  26685. normally, the exception handler that is called to service the
  26686. breakpoint exception will `longjmp' back to `run_child', and it will
  26687. then return to the caller.
  26688.  
  26689. After `run_child' returns, the debugger usually examines the `a_tss'
  26690. variable to find out the reason the debuggee stopped.  The `a_tss'
  26691. variable is defined by the header `debug/tss.h' as follows:
  26692.  
  26693.      typedef struct TSS {
  26694.          unsigned short tss_back_link;
  26695.          unsigned short res0;
  26696.          unsigned long  tss_esp0;
  26697.          unsigned short tss_ss0;
  26698.          unsigned short res1;
  26699.          unsigned long  tss_esp1;
  26700.          unsigned short tss_ss1;
  26701.          unsigned short res2;
  26702.          unsigned long  tss_esp2;
  26703.          unsigned short tss_ss2;
  26704.          unsigned short res3;
  26705.          unsigned long  tss_cr3;
  26706.      
  26707.          unsigned long  tss_eip;
  26708.          unsigned long  tss_eflags;
  26709.          unsigned long  tss_eax;
  26710.          unsigned long  tss_ecx;
  26711.          unsigned long  tss_edx;
  26712.          unsigned long  tss_ebx;
  26713.          unsigned long  tss_esp;
  26714.          unsigned long  tss_ebp;
  26715.          unsigned long  tss_esi;
  26716.          unsigned long  tss_edi;
  26717.          unsigned short tss_es;
  26718.          unsigned short res4;
  26719.          unsigned short tss_cs;
  26720.          unsigned short res5;
  26721.          unsigned short tss_ss;
  26722.          unsigned short res6;
  26723.          unsigned short tss_ds;
  26724.          unsigned short res7;
  26725.          unsigned short tss_fs;
  26726.          unsigned short res8;
  26727.          unsigned short tss_gs;
  26728.          unsigned short res9;
  26729.          unsigned short tss_ldt;
  26730.          unsigned short res10;
  26731.          unsigned short tss_trap;
  26732.          unsigned char  tss_iomap;
  26733.          unsigned char  tss_irqn;
  26734.          unsigned long  tss_error;
  26735.      } TSS;
  26736.      
  26737.      extern TSS a_tss;
  26738.  
  26739. See the example below for a typical tests after `run_child' returns.
  26740.  
  26741. Note that, generally, you'd need to save the standard handles before
  26742. calling `run_child' and restore them after it returns.  Otherwise, if
  26743. the debuggee redirects one of its standard handles, the corresponding
  26744. debugger's standard handle is redirected as well.  *Note
  26745. redir_to_child::, and see *Note redir_to_debugger::.
  26746.  
  26747. Portability
  26748. -----------
  26749.  
  26750. not ANSI, not POSIX
  26751.  
  26752. Example
  26753. -------
  26754.  
  26755.       save_npx ();
  26756.       run_child ();
  26757.       load_npx ();
  26758.      
  26759.       if (a_tss.tss_irqn == 0x21)
  26760.        {
  26761.           status = DEBUGGEE_EXITED;
  26762.           exit_code = a_tss.tss_eax & 0xff;
  26763.        }
  26764.       else
  26765.        {
  26766.           status = DEBUGGEE_GOT_SIGNAL
  26767.           if (a_tss.tss_irqn == 0x75)
  26768.             signal_number = SIGINT;
  26769.           else if (a_tss.tss_irqn == 1 || a_tss.tss_irqn == 3)
  26770.             signal_number = SIGTRAP;  /* a breakpoint */
  26771.        }
  26772.  
  26773. 
  26774. File: libc.info,  Node: save_npx,  Next: sbrk,  Prev: run_child,  Up: Alphabetical List
  26775.  
  26776. save_npx
  26777. ========
  26778.  
  26779. Syntax
  26780. ------
  26781.  
  26782.      #include <debug/dbgcom.h>
  26783.      
  26784.      extern NPX npx;
  26785.      void save_npx (void);
  26786.  
  26787. Description
  26788. -----------
  26789.  
  26790. This function saves the state of the x87 numeric processor in the
  26791. external variable `npx'.  This variable is a structure defined as
  26792. follows in the header `debug/dbgcom.h':
  26793.  
  26794.      typedef struct {
  26795.        unsigned short sig0;
  26796.        unsigned short sig1;
  26797.        unsigned short sig2;
  26798.        unsigned short sig3;
  26799.        unsigned short exponent:15;
  26800.        unsigned short sign:1;
  26801.      } NPXREG;
  26802.      
  26803.      typedef struct {
  26804.        unsigned long control;
  26805.        unsigned long status;
  26806.        unsigned long tag;
  26807.        unsigned long eip;
  26808.        unsigned long cs;
  26809.        unsigned long dataptr;
  26810.        unsigned long datasel;
  26811.        NPXREG reg[8];
  26812.        long double st[8];
  26813.        char st_valid[8];
  26814.        long double mmx[8];
  26815.        char in_mmx_mode;
  26816.        char top;
  26817.      } NPX;
  26818.  
  26819. `save_npx' should be called immediately before `run_child' (*note
  26820. run_child::.) is called to begin or resume the debugged program.
  26821.  
  26822. To restore the x87 state when control is returned to the debugger, call
  26823. `load_npx', see *Note load_npx::.
  26824.  
  26825. Portability
  26826. -----------
  26827.  
  26828. not ANSI, not POSIX
  26829.  
  26830. Example
  26831. -------
  26832.  
  26833.       save_npx ();
  26834.       run_child ();
  26835.       load_npx ();
  26836.  
  26837. 
  26838. File: libc.info,  Node: sbrk,  Next: scanf,  Prev: save_npx,  Up: Alphabetical List
  26839.  
  26840. sbrk
  26841. ====
  26842.  
  26843. Syntax
  26844. ------
  26845.  
  26846.      #include <unistd.h>
  26847.      
  26848.      void *sbrk(int delta)
  26849.  
  26850. Description
  26851. -----------
  26852.  
  26853. This function changes the "break" of the program by adding DELTA to it.
  26854. This is the highest address that your program can access without
  26855. causing a violation.  Since the heap is the region under the break, you
  26856. can expand the heap (where `malloc' gets memory from) by increasing the
  26857. break.
  26858.  
  26859. This function is normally accessed only by `malloc' (*note malloc::.).
  26860.  
  26861. Return Value
  26862. ------------
  26863.  
  26864. The address of the first byte outside of the previous valid address
  26865. range, or -1 if no more memory could be accessed.  In other words, a
  26866. pointer to the chunk of heap you just allocated, if you had passed a
  26867. positive number.
  26868.  
  26869. Portability
  26870. -----------
  26871.  
  26872. not ANSI, not POSIX
  26873.  
  26874. Example
  26875. -------
  26876.  
  26877.      char *buf;
  26878.      buf = sbrk(1000); /* allocate space */
  26879.  
  26880. 
  26881. File: libc.info,  Node: scanf,  Next: Screen Variables,  Prev: sbrk,  Up: Alphabetical List
  26882.  
  26883. scanf
  26884. =====
  26885.  
  26886. Syntax
  26887. ------
  26888.  
  26889.      #include <stdio.h>
  26890.      
  26891.      int scanf(const char *format, ...);
  26892.  
  26893. Description
  26894. -----------
  26895.  
  26896. This function scans formatted text from `stdin' and stores it in the
  26897. variables pointed to by the arguments.  *Note scanf::.
  26898.  
  26899. The format string contains regular characters which much match the input
  26900. exactly as well as a conversion specifiers, which begin with a percent
  26901. symbol.  Any whitespace in the format string matches zero or more of any
  26902. whitespace characters in the input.  Thus, a single space may match a
  26903. newline and two tabs in the input.  All conversions except `c' and `['
  26904. also skip leading whitespace automatically.  Each conversion specifier
  26905. contains the following fields:
  26906.  
  26907.    * An asterisk (`*') which indicates that the input should be
  26908.      converted according to the conversion spec, but not stored
  26909.      anywhere.  This allows to describe an input field that is to be
  26910.      skipped.
  26911.  
  26912.    * A width specifier, which specifies the maximum number of input
  26913.      characters to use in the conversion.
  26914.  
  26915.    * An optional conversion qualifier, which may be `h' to specify
  26916.      `short', `l' to specify doubles or long ints, or `L' or `ll' (two
  26917.      lower-case ell letters) to specify long doubles and the long long
  26918.      type.  If the `h' qualifier appears before a specifier that
  26919.      implies conversion to a `long' or `float' or `double', like in
  26920.      `%hD' or `%hf', it is generally ignored.
  26921.  
  26922.    * The conversion type specifier:
  26923.  
  26924.     `c'
  26925.           Copy the next character (or WIDTH characters) to the given
  26926.           buffer.  This conversion suppresses skipping of the leading
  26927.           whitespace; use `%1s' to read the next non-whitespace
  26928.           character.  Unlike with `%s', the copied characters are *not*
  26929.           terminated with a null character.  If the WIDTH parameter is
  26930.           not specified, a WIDTH of one is implied.
  26931.  
  26932.     `d'
  26933.           Convert the input to a signed `int' using 10 as the base of
  26934.           the number representation.
  26935.  
  26936.     `hd'
  26937.           Convert the input to a signed `short' using 10 as the base.
  26938.  
  26939.     `ld'
  26940.     `D'
  26941.           Convert the input to a signed `long' using 10 as the base.
  26942.  
  26943.     `Ld'
  26944.     `lld'
  26945.     `lD'
  26946.           Convert the input to a signed `long long' using 10 as the
  26947.           base.
  26948.  
  26949.     `e'
  26950.     `E'
  26951.     `f'
  26952.     `F'
  26953.     `g'
  26954.     `G'
  26955.           Convert the input to a floating point number (a `float').
  26956.  
  26957.     `le'
  26958.     `lE'
  26959.     `lf'
  26960.     `lF'
  26961.     `lg'
  26962.     `lG'
  26963.           Convert the input to a `double'.
  26964.  
  26965.     `Le'
  26966.     `LE'
  26967.     `lle'
  26968.     `llE'
  26969.     `Lf'
  26970.     `LF'
  26971.     `llf'
  26972.     `llF'
  26973.     `Lg'
  26974.     `LG'
  26975.     `llg'
  26976.     `llG'
  26977.           Convert the input to a `long double'.
  26978.  
  26979.     `i'
  26980.           Convert the input, determining base automatically by the
  26981.           presence of `0x' or `0' prefixes, and store in an `int'.
  26982.           *Note strtol::.
  26983.  
  26984.     `hi'
  26985.           Like `i', but stores the result in a `short'.
  26986.  
  26987.     `li'
  26988.     `I'
  26989.           Like `i', but stores the result in a `long'.
  26990.  
  26991.     `Li'
  26992.     `lli'
  26993.     `lI'
  26994.           Like `i', but stores the result in a `long long'.
  26995.  
  26996.     `n'
  26997.           Store the number of characters scanned so far into the `int'
  26998.           pointed to by the argument.
  26999.  
  27000.     `hn'
  27001.           Like `n', but the argument should point to a `short'.
  27002.  
  27003.     `ln'
  27004.           Like `n', but the argument should point to a `long'.
  27005.  
  27006.     `Ln'
  27007.     `lln'
  27008.           Like `n', but the argument should point to a `long long'.
  27009.  
  27010.     `o'
  27011.           Convert the input to a signed `int', using base 8.
  27012.  
  27013.     `ho'
  27014.           Convert the input to a signed `short', using base 8.
  27015.  
  27016.     `lo'
  27017.     `O'
  27018.           Convert the input to a signed `long', using base 8.
  27019.  
  27020.     `Lo'
  27021.     `llo'
  27022.     `lO'
  27023.           Convert the input to a signed `long long', using base 8.
  27024.  
  27025.     `p'
  27026.           Convert the input to a pointer.  This is like using the `x'
  27027.           format.
  27028.  
  27029.     `s'
  27030.           Copy the input to the given string, skipping leading
  27031.           whitespace and copying non-whitespace characters up to the
  27032.           next whitespace.  The string stored is then terminated with a
  27033.           null character.
  27034.  
  27035.     `u'
  27036.           Convert the input to an unsigned `int' using 10 as the base.
  27037.  
  27038.     `hu'
  27039.           Convert the input to an unsigned `short' using 10 as the base.
  27040.  
  27041.     `lu'
  27042.     `U'
  27043.           Convert the input to an unsigned `long' using 10 as the base.
  27044.  
  27045.     `Lu'
  27046.     `llu'
  27047.     `lU'
  27048.           Convert the input to an unsigned `long long' using 10 as the
  27049.           base.
  27050.  
  27051.     `x'
  27052.     `X'
  27053.           Convert the input to an unsigned `int', using base 16.
  27054.  
  27055.     `hx'
  27056.     `hX'
  27057.           Convert the input to an unsigned `short', using base 16.
  27058.  
  27059.     `lx'
  27060.     `lX'
  27061.           Convert the input to an unsigned `long', using base 16.
  27062.  
  27063.     `Lx'
  27064.     `LX'
  27065.     `llx'
  27066.     `llX'
  27067.           Convert the input to an unsigned `long long', using base 16.
  27068.  
  27069.     `[...]'
  27070.           Stores the matched characters in a `char' array, followed by a
  27071.           terminating null character.  If you do not specify the WIDTH
  27072.           parameter, `scanf' behaves as if WIDTH had a very large
  27073.           value.  Up to WIDTH characters are consumed and assigned,
  27074.           provided that they match the specification inside the
  27075.           brackets.  The characters between the brackets determine
  27076.           which characters are allowed, and thus when the copying
  27077.           stops.  These characters may be regular characters (example:
  27078.           `[abcd]') or a range of characters (example: `[a-d]').  If
  27079.           the first character is a caret (`^'), then the set specifies
  27080.           the set of characters that do not get copied (i.e.  the set
  27081.           is negated).  To specify that the set contains a close-bracket
  27082.           (`]'), put it immediately after `[' or `[^'.  To specify a
  27083.           literal dash (`-'), write it either immediately after `[' or
  27084.           `[^', or immediately before the closing `]'.
  27085.  
  27086.     `%'
  27087.           This must match a percent character in the input.
  27088.  
  27089. Integer formats make use of `strtol' or `strtoul' to perform the actual
  27090. conversions.  Floating-point conversions use `strtod' and `_strtold'.
  27091.  
  27092. Return Value
  27093. ------------
  27094.  
  27095. The number of items successfully matched and assigned.  If input ends,
  27096. or if there is any input failure before the first item is converted and
  27097. assigned, `EOF' is returned.  Note that literal characters (including
  27098. whitespace) in the format string which matched input characters count
  27099. as "converted items", so input failure *after* such characters were
  27100. read and matched will *not* cause `EOF' to be returned.
  27101.  
  27102. Portability
  27103. -----------
  27104.  
  27105. ANSI (see note 1), POSIX
  27106.  
  27107. Notes:
  27108.  
  27109.   1. The conversion specifiers `F', `D', `I', `O', and `U' are DJGPP
  27110.      extensions; they are provided for compatibility with Borland C and
  27111.      other compilers.  The conversion specifiers for the `long long'
  27112.      data type are GCC extensions.  The meaning of `[a-c]' as a range
  27113.      of characters is a very popular extension to ANSI (which merely
  27114.      says a dash "may have a special meaning" in that context).
  27115.  
  27116.  
  27117. Example
  27118. -------
  27119.  
  27120.      int x, y;
  27121.      char buf[100];
  27122.      scanf("%d %d %s", &x, &y, buf);
  27123.      
  27124.      /* read to end-of-line */
  27125.      scanf("%d %[^\n]\n", &x, buf);
  27126.      /* read letters only */
  27127.      scanf("[a-zA-Z]", buf);
  27128.  
  27129. 
  27130. File: libc.info,  Node: Screen Variables,  Next: ScreenClear,  Prev: scanf,  Up: Alphabetical List
  27131.  
  27132. Screen Variables
  27133. ================
  27134.  
  27135. Syntax
  27136. ------
  27137.  
  27138.      #include <go32.h>
  27139.      #include <pc.h>
  27140.      
  27141.      unsigned long ScreenPrimary;
  27142.      unsigned long ScreenSecondary;
  27143.      extern unsigned char ScreenAttrib;
  27144.  
  27145. Description
  27146. -----------
  27147.  
  27148. The first two variables (actually, they are #define'd aliases to fields
  27149. in the _GO32_INFO_BLOCK structure *note _go32_info_block::.) allow
  27150. access to the video memory of the primary and secondary screens as if
  27151. they were arrays.  To reference them, you must use
  27152. dosmemget()/dosmemput() functions (*Note dosmemget::, *Note
  27153. dosmemput::) or any one of the far pointer functions (*note _far*::.),
  27154. as the video memory is *not* mapped into your default address space.
  27155.  
  27156. The variable ScreenAttrib holds the current attribute which is in use by
  27157. the text screen writes.  The attribute is constructed as follows:
  27158.  
  27159. bits 0-3  - foreground color;
  27160.  
  27161. bits 4-6  - background color;
  27162.  
  27163. bit  7    - blink on (1) or off (0).
  27164.  
  27165. Example
  27166. -------
  27167.  
  27168. _farpokew(_dos_ds, ScreenPrimary, ( ((unsigned short) attr) << 8) +
  27169. char ));
  27170.  
  27171.  
  27172. 
  27173. File: libc.info,  Node: ScreenClear,  Next: ScreenCols,  Prev: Screen Variables,  Up: Alphabetical List
  27174.  
  27175. ScreenClear
  27176. ===========
  27177.  
  27178. Syntax
  27179. ------
  27180.  
  27181.      #include <pc.h>
  27182.      
  27183.      void  ScreenClear(void);
  27184.  
  27185. Description
  27186. -----------
  27187.  
  27188. This function clears the text screen.  It overwrites it by blanks with
  27189. the current background and foreground as specified by ScreenAttrib
  27190. (*note Screen Variables::.).
  27191.  
  27192. Return Value
  27193. ------------
  27194.  
  27195. None.
  27196.  
  27197. Portability
  27198. -----------
  27199.  
  27200. not ANSI, not POSIX
  27201.  
  27202. Example
  27203. -------
  27204.  
  27205.      ScreenClear();
  27206.  
  27207. 
  27208. File: libc.info,  Node: ScreenCols,  Next: ScreenGetChar,  Prev: ScreenClear,  Up: Alphabetical List
  27209.  
  27210. ScreenCols
  27211. ==========
  27212.  
  27213. Syntax
  27214. ------
  27215.  
  27216.      #include <pc.h>
  27217.      
  27218.      int ScreenCols(void);
  27219.  
  27220. Description
  27221. -----------
  27222.  
  27223. This function returns the number of columns of the screen.  It does so
  27224. by looking at the byte at the absolute address 40:4Ah in the BIOS area.
  27225. In text modes, the meaning of number of columns is obvious; in graphics
  27226. modes, this value is the number of columns of text available when using
  27227. the video BIOS functions to write text.
  27228.  
  27229. Return Value
  27230. ------------
  27231.  
  27232. The number of columns.
  27233.  
  27234. Portability
  27235. -----------
  27236.  
  27237. not ANSI, not POSIX
  27238.  
  27239. Example
  27240. -------
  27241.  
  27242.  
  27243.      int available_columns = ScreenCols();
  27244.  
  27245. 
  27246. File: libc.info,  Node: ScreenGetChar,  Next: ScreenGetCursor,  Prev: ScreenCols,  Up: Alphabetical List
  27247.  
  27248. ScreenGetChar
  27249. =============
  27250.  
  27251. Syntax
  27252. ------
  27253.  
  27254.      #include <pc.h>
  27255.      
  27256.      void  ScreenGetChar(int *ch, int *attr, int col, int row);
  27257.  
  27258. Description
  27259. -----------
  27260.  
  27261. This function stores the character and attribute of the current primary
  27262. screen at row given by ROW and column given by COL (these are
  27263. zero-based) into the integers whose address is specified by CH and
  27264. ATTR.  It does so by directly accessing the video memory, so it will
  27265. only work when the screen is in text mode.  You can pass the value
  27266. `NULL' in each of the pointers if you do not want to retrieve the the
  27267. corresponding information.
  27268.  
  27269. *Warning:* note that both the variables CH and ATTR are pointers to an
  27270. `int', not to a `char'!  You *must* pass a pointer to an `int' there,
  27271. or your program will crash or work erratically.
  27272.  
  27273. Return Value
  27274. ------------
  27275.  
  27276. None.
  27277.  
  27278. Portability
  27279. -----------
  27280.  
  27281. not ANSI, not POSIX
  27282.  
  27283. Example
  27284. -------
  27285.  
  27286.      int ch, attr;
  27287.      
  27288.      ScreenGetChar(&ch, &attr, 0, 0);
  27289.  
  27290. 
  27291. File: libc.info,  Node: ScreenGetCursor,  Next: ScreenMode,  Prev: ScreenGetChar,  Up: Alphabetical List
  27292.  
  27293. ScreenGetCursor
  27294. ===============
  27295.  
  27296. Syntax
  27297. ------
  27298.  
  27299.      #include <pc.h>
  27300.      
  27301.      void  ScreenGetCursor(int *row, int *column);
  27302.  
  27303. Description
  27304. -----------
  27305.  
  27306. This function retrieves the current cursor position of the default video
  27307. page by calling function 3 of the interrupt 10h, and stores it in the
  27308. variables pointed by ROW and COLUMN.
  27309.  
  27310. Return Value
  27311. ------------
  27312.  
  27313. None.
  27314.  
  27315. Portability
  27316. -----------
  27317.  
  27318. not ANSI, not POSIX
  27319.  
  27320. Example
  27321. -------
  27322.  
  27323.      ScreenGetCursor(&wherex, &wherey);
  27324.  
  27325. 
  27326. File: libc.info,  Node: ScreenMode,  Next: ScreenPutChar,  Prev: ScreenGetCursor,  Up: Alphabetical List
  27327.  
  27328. ScreenMode
  27329. ==========
  27330.  
  27331. Syntax
  27332. ------
  27333.  
  27334.      #include <pc.h>
  27335.      
  27336.      int  ScreenMode(void);
  27337.  
  27338. Description
  27339. -----------
  27340.  
  27341. This function reports the current video mode as known to the system
  27342. BIOS.  It does so by accessing the byte at absolute address 40:49h.
  27343.  
  27344. Return Value
  27345. ------------
  27346.  
  27347. The video mode.
  27348.  
  27349. Portability
  27350. -----------
  27351.  
  27352. not ANSI, not POSIX
  27353.  
  27354. Example
  27355. -------
  27356.  
  27357.      video_mode = ScreenMode();
  27358.  
  27359. 
  27360. File: libc.info,  Node: ScreenPutChar,  Next: ScreenPutString,  Prev: ScreenMode,  Up: Alphabetical List
  27361.  
  27362. ScreenPutChar
  27363. =============
  27364.  
  27365. Syntax
  27366. ------
  27367.  
  27368.      #include <pc.h>
  27369.      
  27370.      void  ScreenPutChar(int ch, int attr, int col, int row);
  27371.  
  27372. Description
  27373. -----------
  27374.  
  27375. This function writes the character whose value is specified in CH with
  27376. an attribute ATTR at row given by ROW and column given by COL, which
  27377. are zero-based.  It does so by directly accessing the video memory, so
  27378. it will only work when the screen is in text mode.
  27379.  
  27380. Return Value
  27381. ------------
  27382.  
  27383. None.
  27384.  
  27385. Portability
  27386. -----------
  27387.  
  27388. not ANSI, not POSIX
  27389.  
  27390. Example
  27391. -------
  27392.  
  27393.      ScreenPutChar('R', (BLUE << 4) | LIGHTMAGENTA, 75, 0);
  27394.  
  27395. 
  27396. File: libc.info,  Node: ScreenPutString,  Next: ScreenRetrieve,  Prev: ScreenPutChar,  Up: Alphabetical List
  27397.  
  27398. ScreenPutString
  27399. ===============
  27400.  
  27401. Syntax
  27402. ------
  27403.  
  27404.      #include <pc.h>
  27405.      
  27406.      void  ScreenPutString(const char *str, int attr, int column, int row);
  27407.  
  27408. Description
  27409. -----------
  27410.  
  27411. Beginning at screen position given by COLUMN and ROW, this function
  27412. displays the string given by STR.  Each string character gets the
  27413. attribute given by ATTR.  If COLUMN or ROW have values outside legal
  27414. range for current video mode, nothing happens.  The variables ROW and
  27415. COLUMN are zero-based (e.g., the topmost row is row 0).
  27416.  
  27417. Return Value
  27418. ------------
  27419.  
  27420. None.
  27421.  
  27422. Portability
  27423. -----------
  27424.  
  27425. not ANSI, not POSIX
  27426.  
  27427. Example
  27428. -------
  27429.  
  27430.      ScreenPutString("Hello, world!", (BLUE << 4) | LIGHTBLUE, 20, 10);
  27431.  
  27432. 
  27433. File: libc.info,  Node: ScreenRetrieve,  Next: ScreenRows,  Prev: ScreenPutString,  Up: Alphabetical List
  27434.  
  27435. ScreenRetrieve
  27436. ==============
  27437.  
  27438. Syntax
  27439. ------
  27440.  
  27441.      #include <pc.h>
  27442.      
  27443.      void  ScreenRetrieve(void *buf);
  27444.  
  27445. Description
  27446. -----------
  27447.  
  27448. This function stores a replica of the current primary screen contents in
  27449. the buffer pointed to by BUF.  It assumes without checking that BUF has
  27450. enough storage to hold the data.  The required storage can be computed
  27451. as `ScreenRows()*ScreenCols()*2' (*Note ScreenRows::, *Note
  27452. ScreenCols::).
  27453.  
  27454. Return Value
  27455. ------------
  27456.  
  27457. None.
  27458.  
  27459. Portability
  27460. -----------
  27461.  
  27462. not ANSI, not POSIX
  27463.  
  27464. Example
  27465. -------
  27466.  
  27467.      unsigned *saved_screen = (unsigned *)alloca(ScreenRows()*ScreenCols()*2;
  27468.      
  27469.      ScreenRetrieve(saved_screen);
  27470.  
  27471. 
  27472. File: libc.info,  Node: ScreenRows,  Next: ScreenSetCursor,  Prev: ScreenRetrieve,  Up: Alphabetical List
  27473.  
  27474. ScreenRows
  27475. ==========
  27476.  
  27477. Syntax
  27478. ------
  27479.  
  27480.      #include <pc.h>
  27481.      
  27482.      int ScreenRows(void);
  27483.  
  27484. Description
  27485. -----------
  27486.  
  27487. This function returns the number of rows of the text screen.  It does so
  27488. by looking at the byte at the absolute address 40:84h in the BIOS area.
  27489. This method works only for video adapters with their own BIOS
  27490. extensions, like EGA, VGA, SVGA etc.
  27491.  
  27492. Return Value
  27493. ------------
  27494.  
  27495. The number of rows.
  27496.  
  27497. Portability
  27498. -----------
  27499.  
  27500. not ANSI, not POSIX
  27501.  
  27502. Example
  27503. -------
  27504.  
  27505.  
  27506.      int rows = ScreenRows();
  27507.  
  27508. 
  27509. File: libc.info,  Node: ScreenSetCursor,  Next: ScreenUpdate,  Prev: ScreenRows,  Up: Alphabetical List
  27510.  
  27511. ScreenSetCursor
  27512. ===============
  27513.  
  27514. Syntax
  27515. ------
  27516.  
  27517.      #include <pc.h>
  27518.      
  27519.      void  ScreenSetCursor(int  row, int  column);
  27520.  
  27521. Description
  27522. -----------
  27523.  
  27524. This function moves the cursor position on the default video page to the
  27525. point given by (zero-based) ROW and COLUMN, by calling function 2 of
  27526. interrupt 10h.
  27527.  
  27528. Return Value
  27529. ------------
  27530.  
  27531. None.
  27532.  
  27533. Portability
  27534. -----------
  27535.  
  27536. not ANSI, not POSIX
  27537.  
  27538. Example
  27539. -------
  27540.  
  27541.      ScreenSetCursor(0, 0);   /* home the cursor */
  27542.  
  27543. 
  27544. File: libc.info,  Node: ScreenUpdate,  Next: ScreenUpdateLine,  Prev: ScreenSetCursor,  Up: Alphabetical List
  27545.  
  27546. ScreenUpdate
  27547. ============
  27548.  
  27549. Syntax
  27550. ------
  27551.  
  27552.      #include <pc.h>
  27553.      
  27554.      void  ScreenUpdate(void *buf);
  27555.  
  27556. Description
  27557. -----------
  27558.  
  27559. This function writes the contents of the buffer BUF to the primary
  27560. screen.  The buffer should contain an exact replica of the video memory,
  27561. including the characters and their attributes.
  27562.  
  27563. Return Value
  27564. ------------
  27565.  
  27566. None.
  27567.  
  27568. Portability
  27569. -----------
  27570.  
  27571. not ANSI, not POSIX
  27572.  
  27573. Example
  27574. -------
  27575.  
  27576.      ScreenUpdate(saved_screen);
  27577.  
  27578. 
  27579. File: libc.info,  Node: ScreenUpdateLine,  Next: ScreenVisualBell,  Prev: ScreenUpdate,  Up: Alphabetical List
  27580.  
  27581. ScreenUpdateLine
  27582. ================
  27583.  
  27584. Syntax
  27585. ------
  27586.  
  27587.      #include <pc.h>
  27588.      
  27589.      void  ScreenUpdateLine(void *buf, int row);
  27590.  
  27591. Description
  27592. -----------
  27593.  
  27594. This function writes the contents of BUF to the screen line number
  27595. given in ROW (the topmost line is row 0), on the primary screen.
  27596.  
  27597. Return Value
  27598. ------------
  27599.  
  27600. None.
  27601.  
  27602. Portability
  27603. -----------
  27604.  
  27605. not ANSI, not POSIX
  27606.  
  27607. Example
  27608. -------
  27609.  
  27610.      ScreenUpdateLine(line_buf, 10);
  27611.  
  27612. 
  27613. File: libc.info,  Node: ScreenVisualBell,  Next: searchpath,  Prev: ScreenUpdateLine,  Up: Alphabetical List
  27614.  
  27615. ScreenVisualBell
  27616. ================
  27617.  
  27618. Syntax
  27619. ------
  27620.  
  27621.      #include <pc.h>
  27622.      
  27623.      void  ScreenVisualBell(void);
  27624.  
  27625. Description
  27626. -----------
  27627.  
  27628. This function flashes the screen colors to produce the effect of "visual
  27629. bell'.  It does so by momentarily inverting the colors of every
  27630. character on the screen.
  27631.  
  27632. Return Value
  27633. ------------
  27634.  
  27635. None.
  27636.  
  27637. Portability
  27638. -----------
  27639.  
  27640. not ANSI, not POSIX
  27641.  
  27642. Example
  27643. -------
  27644.  
  27645.      ScreenVisualBell();
  27646.  
  27647. 
  27648. File: libc.info,  Node: searchpath,  Next: seekdir,  Prev: ScreenVisualBell,  Up: Alphabetical List
  27649.  
  27650. searchpath
  27651. ==========
  27652.  
  27653. Syntax
  27654. ------
  27655.  
  27656.      #include <dir.h>
  27657.      
  27658.      char * searchpath(const char *file);
  27659.  
  27660. Description
  27661. -----------
  27662.  
  27663. Given a name of a file in FILE, searches for that file in a list of
  27664. directories, including the current working directory and directories
  27665. listed in the `PATH' environment variable, and if found, returns the
  27666. file name with leading directories prepended, so that the result can be
  27667. used to access the file (e.g. by calling `open' or `stat').
  27668.  
  27669. If FILE includes a drive letter or leading directories, `searchpath'
  27670. first tries that name unaltered, in case it is already a
  27671. fully-qualified path, or is relative to the current working directory.
  27672. If that fails, it tries every directory in `PATH' in turn.  Note that
  27673. this will find e.g. `c:/foo/bar/baz.exe' if you pass `bar/baz.exe' to
  27674. `searchpath' and if `c:/foo' is mentioned in `PATH'.
  27675.  
  27676. Return Value
  27677. ------------
  27678.  
  27679. When successfull, the function returns a pointer to a static buffer
  27680. where the full pathname of the found file is stored.  Otherwise, it
  27681. returns `NULL'.  (The static buffer is overwritten on each call.)
  27682.  
  27683. Portability
  27684. -----------
  27685.  
  27686. not ANSI, not POSIX
  27687.  
  27688. This function is provided for compatibility with Borland's library.
  27689. However, note that the Borland version disregards the leading
  27690. directories altogether and searches for the basename only.  Thus, it
  27691. will happily find e.g. `c:/foo/bar/baz.exe', even if the directory
  27692. `c:/foo/bar' doesn't exist, provided that `baz.exe' is somewhere on
  27693. your `PATH'.  We think this is a bug, so DJGPP's implementation doesn't
  27694. behave like that.
  27695.  
  27696. Example
  27697. -------
  27698.  
  27699.        printf("%s was found as %s\n", argv[1], searchpath(argv[1]));
  27700.  
  27701. 
  27702. File: libc.info,  Node: seekdir,  Next: select,  Prev: searchpath,  Up: Alphabetical List
  27703.  
  27704. seekdir
  27705. =======
  27706.  
  27707. Syntax
  27708. ------
  27709.  
  27710.      #include <dirent.h>
  27711.      
  27712.      void seekdir(DIR *dir, long loc);
  27713.  
  27714. Description
  27715. -----------
  27716.  
  27717. This function sets the location pointer in DIR to the specified LOC.
  27718. Note that the value used for LOC should be either zero or a value
  27719. returned by `telldir' (*note telldir::.).  The next call to `readdir'
  27720. (*note readdir::.) will read whatever entry follows that point in the
  27721. directory.
  27722.  
  27723. Return Value
  27724. ------------
  27725.  
  27726. None.
  27727.  
  27728. Portability
  27729. -----------
  27730.  
  27731. not ANSI, not POSIX
  27732.  
  27733. Example
  27734. -------
  27735.  
  27736.      int q = telldir(dir);
  27737.      do_stuff();
  27738.      seekdir(dir, q);
  27739.  
  27740. 
  27741. File: libc.info,  Node: select,  Next: _set_screen_lines,  Prev: seekdir,  Up: Alphabetical List
  27742.  
  27743. select
  27744. ======
  27745.  
  27746. Syntax
  27747. ------
  27748.  
  27749.      #include <time.h>
  27750.      
  27751.      int
  27752.      select(int nfds,
  27753.          fd_set *readfds,
  27754.          fd_set *writefds,
  27755.          fd_set *exceptfds,
  27756.          struct timeval *timeout)
  27757.  
  27758. Description
  27759. -----------
  27760.  
  27761. This function waits for files to be ready for input or output, or to
  27762. have exceptional condition pending, or for a timeout.
  27763.  
  27764. Each `fd_set' variable is a bitmap representation of a set of file
  27765. descriptors, one bit for every descriptor.  The following macros shall
  27766. be used to deal with these sets:
  27767.  
  27768. `FD_ZERO(p)'
  27769.      Initialize the set to all zeros.
  27770.  
  27771. `FD_SET(n, p)'
  27772.      Set member N in set P.
  27773.  
  27774. `FD_CLR(n, p)'
  27775.      Clear member N in set P.
  27776.  
  27777. `FD_ISSET(n, p)'
  27778.      Return the value of member N in set P.
  27779.  
  27780. `FD_SETSIZE'
  27781.      The maximum number of descriptors supported by the system.
  27782.  
  27783. The NFDS parameter is the number of bits to be examined in each of the
  27784. `fd_set' sets: the function will only check file descriptors `0'
  27785. through `NFDS - 1', even if some bits are set for descriptors beyond
  27786. that.
  27787.  
  27788. On input, some of the bits of each one of the `fd_set' sets for which
  27789. the function should wait, should be set using the `FD_SET' macro.
  27790. `select' examines only those descriptors whose bits are set.
  27791.  
  27792. Any of `readfds', `writefds', and `exceptfds' can be a `NULL' pointer,
  27793. if the caller is not interested in testing the corresponding conditions.
  27794.  
  27795. On output, if `select' returns a non-negative value, each non-`NULL'
  27796. argument of the three sets will be replaced with a subset in which a
  27797. bit is set for every descriptor that was found to be, respectively,
  27798. ready for input, ready for output, and pending an exceptional
  27799. condition.  Note that if `select' returns -1, meaning a failure, the
  27800. descriptor sets are *unchanged*, so you should always test the return
  27801. value before looking at the bits in the returned sets.
  27802.  
  27803. The TIMEOUT value may be a NULL pointer (no timeout, i.e., wait
  27804. forever), a pointer to a zero-value structure (poll mode, i.e., test
  27805. once and exit immediately), or a pointer to a `struct timeval' variable
  27806. (timeout: `select' will repeatedly test all the descriptors until some
  27807. of them become ready, or the timeout expires).
  27808.  
  27809. `struct timeval' is defined as follows:
  27810.  
  27811.      struct timeval {
  27812.        time_t tv_sec;
  27813.        long tv_usec;
  27814.      };
  27815.  
  27816. Return Value
  27817. ------------
  27818.  
  27819. On successfull return, `select' returns the number of files ready, or
  27820. 0, if the timeout expired.  The input sets are replaced with subsets
  27821. that describe which files are ready for which operations.  If `select'
  27822. returns 0 (i.e., the timeout has expired), all the non-`NULL' sets have
  27823. all their bits reset to zero.
  27824.  
  27825. On failure, `select' returns -1, sets `errno' to a suitable value, and
  27826. leaves the descriptor sets unchanged.
  27827.  
  27828. Portability
  27829. -----------
  27830.  
  27831. not ANSI, not POSIX
  27832.  
  27833. Example
  27834. -------
  27835.  
  27836.        struct timeval timeout;
  27837.        fd_set read_fds, write_fds;
  27838.        int i, select_result;
  27839.      
  27840.        timeout.tv_sec = 5;  /* 5-second timeout */
  27841.        timeout.tv_usec = 0;
  27842.      
  27843.        /* Display status of the 5 files open by default.  */
  27844.        for (i = 0; i < 5; i++)
  27845.          {
  27846.      
  27847.            FD_ZERO (&read_fds);
  27848.            FD_SET (i, &read_fds);
  27849.            select_result = select (i + 1, &read_fds, 0, 0, &timeout);
  27850.            if (select_result == -1)
  27851.              {
  27852.                fprintf(stderr, "%d: Failure for input", i);
  27853.                perror("");
  27854.              }
  27855.            else
  27856.              fprintf(stderr,
  27857.                      "%d: %s ready for input\n", i, select_result ? "" : "NOT");
  27858.            FD_ZERO (&write_fds);
  27859.            FD_SET (i, &write_fds);
  27860.            select_result = select (i + 1, 0, &write_fds, 0, &timeout);
  27861.            if (select_result == -1)
  27862.              {
  27863.                fprintf(stderr, "%d: Failure for output", i);
  27864.                perror("");
  27865.              }
  27866.            else
  27867.              fprintf(stderr,
  27868.                      "%d: %s ready for output\n", i, select_result ? "" : "NOT");
  27869.          }
  27870.  
  27871. Implementation Notes
  27872. --------------------
  27873.  
  27874. The following notes describe some details pertinent to the DJGPP
  27875. implementation of `select':
  27876.  
  27877.    * While `select' waits for the timeout to expire, it repeatedly calls
  27878.      the `__dpmi_yield' function (*note __dpmi_yield::.), so that any
  27879.      other programs that run at the same time (e.g., on Windows) get
  27880.      more CPU time.
  27881.  
  27882.    * A file handle that belongs to a `FILE' object created by `fopen'
  27883.      or `fdopen' (*note fopen::.) for which `feof' or `ferror' return
  27884.      non-zero, will be reported in the `exceptfds' set; also, such a
  27885.      handle will be reported not input-ready if there are no pending
  27886.      buffered characters in the `FILE' object.  This might be a feature
  27887.      or a bug, depending on your point of view; in particular, Unix
  27888.      implementations usually don't check buffered input.  Portable
  27889.      programs should refrain from mixing `select' with buffered I/O.
  27890.  
  27891.    * DOS doesn't support exceptional conditions, so file handles used
  27892.      for unbuffered I/O will *never* be marked in `exceptfds'.
  27893.  
  27894.    * DOS always returns an output-ready indication for a file descriptor
  27895.      connected to a disk file.  So use of `writefds' is only meaningful
  27896.      for character devices.
  27897.  
  27898.    * The usual text-mode input from the keyboard and other character
  27899.      devices is line-buffered by DOS.  This means that if you type one
  27900.      character, `select' will indicate that file handle 0 is ready for
  27901.      input, but a call to `getc' will still block until the <Enter> key
  27902.      is pressed.  If you need to make sure that reading a single
  27903.      character won't block, you should read either with BIOS functions
  27904.      such as `getkey' (*note getkey::., or with raw input DOS functions
  27905.      such as `getch' (*note getch::.), or switch the handle to binary
  27906.      mode with a call to `setmode' (*note setmode::.).
  27907.  
  27908. 
  27909. File: libc.info,  Node: _set_screen_lines,  Next: setbuf,  Prev: select,  Up: Alphabetical List
  27910.  
  27911. _set_screen_lines
  27912. =================
  27913.  
  27914. Syntax
  27915. ------
  27916.  
  27917.      #include <conio.h>
  27918.      
  27919.      void _set_screen_lines(int nlines);
  27920.  
  27921. Description
  27922. -----------
  27923.  
  27924. This function sets the text screen width to 80 and its height to the
  27925. value given by NLINES, which can be one of the following: 25, 28, 35,
  27926. 40, 43 or 50.  On a CGA, only 25-line screen is supported.  On an EGA,
  27927. you can use 25, 35 and 43.  VGA, PGA and MCGA support all of the
  27928. possible dimensions.  The number of columns (i.e., screen width) is 80
  27929. for all of the above resolutions, because the standard EGA/VGA has no
  27930. way of changing it.  After this function returns, calls to
  27931. `gettextinfo()' will return the actual screen dimensions as set by
  27932. `_set_screen_lines()'.  That is, you can e.g. test whether
  27933. `_set_screen_lines()' succeeded by checking the screen height returned
  27934. by `gettextinfo()' against the desired height.  This function has a
  27935. side effect of erasing the screen contents, so application programs
  27936. which use it should make their own arrangements to redisplay it.
  27937.  
  27938. Portability
  27939. -----------
  27940.  
  27941. not ANSI, not POSIX
  27942.  
  27943. 
  27944. File: libc.info,  Node: setbuf,  Next: setbuffer,  Prev: _set_screen_lines,  Up: Alphabetical List
  27945.  
  27946. setbuf
  27947. ======
  27948.  
  27949. Syntax
  27950. ------
  27951.  
  27952.      #include <stdio.h>
  27953.      
  27954.      void setbuf(FILE *file, char *buffer);
  27955.  
  27956. Description
  27957. -----------
  27958.  
  27959. This function modifies the buffering characteristics of FILE.  First,
  27960. if the file already has a buffer, it is freed.  If there was any
  27961. pending data in it, it is lost, so this function should only be used
  27962. immediately after a call to `fopen'.
  27963.  
  27964. If the BUFFER passed is `NULL', the file is set to unbuffered.  If a
  27965. non-`NULL' buffer is passed, it must be at least `BUFSIZ' bytes in
  27966. size, and the file is set to fully buffered.
  27967.  
  27968. *Note setbuffer::.  *Note setlinebuf::.  *Note setvbuf::.
  27969.  
  27970. Return Value
  27971. ------------
  27972.  
  27973. None.
  27974.  
  27975. Portability
  27976. -----------
  27977.  
  27978. ANSI, POSIX
  27979.  
  27980. Example
  27981. -------
  27982.  
  27983.      setbuf(stdout, malloc(BUFSIZ));
  27984.  
  27985. 
  27986. File: libc.info,  Node: setbuffer,  Next: setcbrk,  Prev: setbuf,  Up: Alphabetical List
  27987.  
  27988. setbuffer
  27989. =========
  27990.  
  27991. Syntax
  27992. ------
  27993.  
  27994.      #include <stdio.h>
  27995.      
  27996.      void setbuffer(FILE *file, char *buffer, int length);
  27997.  
  27998. Description
  27999. -----------
  28000.  
  28001. This function modifies the buffering characteristics of FILE.  First,
  28002. if the file already has a buffer, it is freed.  If there was any
  28003. pending data in it, it is lost, so this function should only be used
  28004. immediately after a call to `fopen'.
  28005.  
  28006. If the BUFFER passed is `NULL', the file is set to unbuffered.  If a
  28007. non-`NULL' buffer is passed, it must be at least SIZE bytes in size,
  28008. and the file is set to fully buffered.
  28009.  
  28010. *Note setbuf::.  *Note setlinebuf::.  *Note setvbuf::.
  28011.  
  28012. Return Value
  28013. ------------
  28014.  
  28015. None.
  28016.  
  28017. Portability
  28018. -----------
  28019.  
  28020. not ANSI, not POSIX
  28021.  
  28022. Example
  28023. -------
  28024.  
  28025.      setbuffer(stdout, malloc(10000), 10000);
  28026.  
  28027. 
  28028. File: libc.info,  Node: setcbrk,  Next: _setcursortype,  Prev: setbuffer,  Up: Alphabetical List
  28029.  
  28030. setcbrk
  28031. =======
  28032.  
  28033. Syntax
  28034. ------
  28035.  
  28036.      #include <dos.h>
  28037.      
  28038.      void setcbrk(int check);
  28039.  
  28040. Description
  28041. -----------
  28042.  
  28043. Set the setting of the Ctrl-Break checking flag in MS-DOS.  If CHECK is
  28044. zero, checking is not done.  If nonzero, checking is done.
  28045.  
  28046. Return Value
  28047. ------------
  28048.  
  28049. None.
  28050.  
  28051. Portability
  28052. -----------
  28053.  
  28054. not ANSI, not POSIX
  28055.  
  28056. 
  28057. File: libc.info,  Node: _setcursortype,  Next: setdate,  Prev: setcbrk,  Up: Alphabetical List
  28058.  
  28059. _setcursortype
  28060. ==============
  28061.  
  28062. Syntax
  28063. ------
  28064.  
  28065.      #include <conio.h>
  28066.      
  28067.      void _setcursortype(int _type);
  28068.  
  28069. Description
  28070. -----------
  28071.  
  28072. Sets the cursor type.  _TYPE is one of the following:
  28073.  
  28074. `_NOCURSOR'
  28075.      No cursor is displayed.
  28076.  
  28077. `_SOLIDCURSOR'
  28078.      A solid block is displayed.
  28079.  
  28080. `_NORMALCURSOR'
  28081.      An underline cursor is displayed.
  28082.  
  28083. Portability
  28084. -----------
  28085.  
  28086. not ANSI, not POSIX
  28087.  
  28088. 
  28089. File: libc.info,  Node: setdate,  Next: setdisk,  Prev: _setcursortype,  Up: Alphabetical List
  28090.  
  28091. setdate
  28092. =======
  28093.  
  28094. Syntax
  28095. ------
  28096.  
  28097.      #include <dos.h>
  28098.      
  28099.      void setdate(struct date *ptr);
  28100.  
  28101. Description
  28102. -----------
  28103.  
  28104. This function sets the current time.
  28105.  
  28106. For the description of `struct date', see *Note getdate::.  Also see
  28107. *Note settime::.
  28108.  
  28109. Return Value
  28110. ------------
  28111.  
  28112. None.
  28113.  
  28114. Portability
  28115. -----------
  28116.  
  28117. not ANSI, not POSIX
  28118.  
  28119. Example
  28120. -------
  28121.  
  28122.      struct date d;
  28123.      setdate(&d);
  28124.  
  28125. 
  28126. File: libc.info,  Node: setdisk,  Next: setenv,  Prev: setdate,  Up: Alphabetical List
  28127.  
  28128. setdisk
  28129. =======
  28130.  
  28131. Syntax
  28132. ------
  28133.  
  28134.      #include <dir.h>
  28135.      
  28136.      int setdisk(int drive);
  28137.  
  28138. Description
  28139. -----------
  28140.  
  28141. This function sets the current disk (0=A).
  28142.  
  28143. See also *Note getdisk::.
  28144.  
  28145. Return Value
  28146. ------------
  28147.  
  28148. The highest drive actually present that the system can reference.
  28149.  
  28150. Portability
  28151. -----------
  28152.  
  28153. not ANSI, not POSIX
  28154.  
  28155. Example
  28156. -------
  28157.  
  28158.      printf("There are %d drives\n", setdisk(getdisk()));
  28159.  
  28160. 
  28161. File: libc.info,  Node: setenv,  Next: setftime,  Prev: setdisk,  Up: Alphabetical List
  28162.  
  28163. setenv
  28164. ======
  28165.  
  28166. Syntax
  28167. ------
  28168.  
  28169.      #include <stdlib.h>
  28170.      
  28171.      int setenv(const char *name, const char *value, int rewrite);
  28172.  
  28173. Description
  28174. -----------
  28175.  
  28176. This function sets the environment variable NAME to VALUE.  If REWRITE
  28177. is set, then this function will replace any existing value.  If it is
  28178. not set, it will only put the variable into the environment if that
  28179. variable isn't already defined.
  28180.  
  28181. Return Value
  28182. ------------
  28183.  
  28184. Zero on success, -1 on failure.
  28185.  
  28186. Portability
  28187. -----------
  28188.  
  28189. not ANSI, not POSIX
  28190.  
  28191. 
  28192. File: libc.info,  Node: setftime,  Next: setgid,  Prev: setenv,  Up: Alphabetical List
  28193.  
  28194. setftime
  28195. ========
  28196.  
  28197. Syntax
  28198. ------
  28199.  
  28200.      #include <dos.h>
  28201.      
  28202.      int setftime(int handle, struct ftime *ftimep);
  28203.  
  28204. Description
  28205. -----------
  28206.  
  28207. This function sets the modification time of a file.  Note that since
  28208. writing to a file, and closing a file opened for writing, also sets the
  28209. modification time, you should only use this function on files opened for
  28210. reading.
  28211.  
  28212. *Note getftime::, for the description of `struct ftime'.
  28213.  
  28214. Return Value
  28215. ------------
  28216.  
  28217. Zero on success, nonzero on failure.
  28218.  
  28219. Portability
  28220. -----------
  28221.  
  28222. not ANSI, not POSIX
  28223.  
  28224. Example
  28225. -------
  28226.  
  28227.      int q = open("data.txt", O_RDONLY);
  28228.      struct ftime f;
  28229.      f.ft_sec = f.ft_min = f.ft_hour = f.ft_day = f.ft_month = f.ft_year = 0;
  28230.      setftime(q, &f);
  28231.      close(q);
  28232.  
  28233. 
  28234. File: libc.info,  Node: setgid,  Next: setgrent,  Prev: setftime,  Up: Alphabetical List
  28235.  
  28236. setgid
  28237. ======
  28238.  
  28239. Syntax
  28240. ------
  28241.  
  28242.      #include <unistd.h>
  28243.      
  28244.      int setgid(gid_t gid);
  28245.  
  28246. Description
  28247. -----------
  28248.  
  28249. This function is simulated, since MS-DOS does not support group IDs.
  28250.  
  28251. Return Value
  28252. ------------
  28253.  
  28254. If GID is equal to that returned by *note getgid::., returns zero.
  28255. Otherwise, returns -1 and sets `errno' to EPERM.
  28256.  
  28257. Portability
  28258. -----------
  28259.  
  28260. not ANSI, POSIX
  28261.  
  28262. 
  28263. File: libc.info,  Node: setgrent,  Next: setitimer,  Prev: setgid,  Up: Alphabetical List
  28264.  
  28265. setgrent
  28266. ========
  28267.  
  28268. Syntax
  28269. ------
  28270.  
  28271.      #include <grp.h>
  28272.      
  28273.      void setgrent(void);
  28274.  
  28275. Description
  28276. -----------
  28277.  
  28278. This function should be called before any call to `getgrent',
  28279. `getgrgid', or `getgrnam', to start searching the groups' list from the
  28280. beginning.  *Note getgrent::.
  28281.  
  28282. Return Value
  28283. ------------
  28284.  
  28285. None.
  28286.  
  28287. Portability
  28288. -----------
  28289.  
  28290. not ANSI, not POSIX
  28291.  
  28292. 
  28293. File: libc.info,  Node: setitimer,  Next: setjmp,  Prev: setgrent,  Up: Alphabetical List
  28294.  
  28295. setitimer
  28296. =========
  28297.  
  28298. Syntax
  28299. ------
  28300.  
  28301.      #include <sys/time.h>
  28302.      
  28303.      extern long __djgpp_clock_tick_interval;
  28304.      
  28305.      struct timeval {
  28306.        time_t tv_sec;
  28307.        long tv_usec;
  28308.      };
  28309.      
  28310.      struct itimerval {
  28311.        struct timeval it_interval;    /* timer interval */
  28312.        struct timeval it_value;       /* current value */
  28313.      };
  28314.      
  28315.      int setitimer(int which, struct itimerval *value, struct itimerval *ovalue);
  28316.  
  28317. Description
  28318. -----------
  28319.  
  28320. Each process has two interval timers, `ITIMER_REAL' and `ITIMER_PROF',
  28321. which raise the signals `SIGALRM' and `SIGPROF', respectively.  These
  28322. are typically used to provide `alarm' and profiling capabilities.
  28323.  
  28324. This function changes the current value of the interval timer specified
  28325. by WHICH to the values in structure VALUE.  The previous value of the
  28326. timer is returned in OVALUE if it is not a `NULL' pointer.  When the
  28327. timer expires, the appropriate signal is raised.
  28328.  
  28329. If VALUE is a `NULL' pointer, `setitimer' stores the previous timer
  28330. value in OVALUE (if it is non-`NULL'), like `getitimer' does, but
  28331. otherwise does nothing.
  28332.  
  28333. A timer is defined by the `itimerval' structure.  If the `it_value'
  28334. member is non-zero it specifies the time to the next timer expiration.
  28335. If `it_interval' is non-zero, it specifies the value with which to
  28336. reload the timer upon expiration.  Setting `it_value' to zero disables
  28337. a timer.  Setting `it_interval' to zero causes the timer to stop after
  28338. the next expiration (assuming that `it_value' is non-zero).
  28339.  
  28340. Although times can be given with microsecond resolution, the granularity
  28341. is determined by the timer interrupt frequency.  Time values smaller
  28342. than the system clock granularity will be rounded up to that
  28343. granularity, before they are used.  This means that passing a very small
  28344. but non-zero value in `value->it_interval.tv_usec' will cause the
  28345. system clock granularity to be stored and returned by the next call to
  28346. `getitimer'.  See the example below.
  28347.  
  28348. If an application changes the system clock speed by reprogramming the
  28349. timer chip, it should make the new clock speed known to `setitimer',
  28350. otherwise intervals smaller than the default PC clock speed cannot be
  28351. set with a call to `setitimer' due to rounding up to clock granularity.
  28352. To this end, an external variable `__djgpp_clock_tick_interval' is
  28353. provided, which should be set to the number of microseconds between two
  28354. timer ticks that trigger Interrupt 8.  The default value of this
  28355. variable is `-1', which causes `setitimer' to work with 54926
  28356. microsecond granularity that corresponds to the standard 18.2Hz clock
  28357. frequency.  The library never changes the value of
  28358. `__djgpp_clock_tick_interval'.
  28359.  
  28360. Return Value
  28361. ------------
  28362.  
  28363. Returns 0 on success, -1 on failure (and sets `errno').
  28364.  
  28365. Portability
  28366. -----------
  28367.  
  28368. not ANSI, not POSIX
  28369.  
  28370. Bugs
  28371. ----
  28372.  
  28373. This version uses `uclock' (*note uclock::.) to determine the time of
  28374. expiration.  Under Windows 3.X, this fails because the OS reprograms
  28375. the timer.  Under Windows 9X, `uclock' sometimes reports erratic
  28376. (non-increasing) time values; in these cases the timer might fire at a
  28377. wrong time.
  28378.  
  28379. A misfeature of Windows 9X prevents the timer tick interrupt from being
  28380. delivered to programs that are in the background (i.e. don't have the
  28381. focus), even though the program itself might continue to run, if you
  28382. uncheck the `Background: Always suspend' property in the Property
  28383. Sheets.  Therefore, the timers will not work in background programs on
  28384. Windows 9X.
  28385.  
  28386. Also, debuggers compiled with DJGPP v2.02 and earlier cannot cope with
  28387. timers and report `SIGSEGV' or `SIGABRT', since signals were not
  28388. supported in a debugged program before DJGPP v2.03.
  28389.  
  28390. Example
  28391. -------
  28392.  
  28393.      /* Find out what is the system clock granularity.  */
  28394.      
  28395.        struct itimerval tv;
  28396.      
  28397.        tv.it_interval.tv_sec = 0;
  28398.        tv.it_interval.tv_usec = 1;
  28399.        tv.it_value.tv_sec = 0;
  28400.        tv.it_value.tv_usec = 0;
  28401.        setitimer (ITIMER_REAL, &tv, 0);
  28402.        setitimer (ITIMER_REAL, 0, &tv);
  28403.        printf ("System clock granularity: %ld microseconds.\n",
  28404.            tv.it_interval.tv_usec);
  28405.  
  28406. 
  28407. File: libc.info,  Node: setjmp,  Next: setlinebuf,  Prev: setitimer,  Up: Alphabetical List
  28408.  
  28409. setjmp
  28410. ======
  28411.  
  28412. Syntax
  28413. ------
  28414.  
  28415.      #include <setjmp.h>
  28416.      
  28417.      int setjmp(jmp_buf j);
  28418.  
  28419. Description
  28420. -----------
  28421.  
  28422. This function stores the complete CPU state into J.  This information
  28423. is complete enough that `longjmp' (*note longjmp::.) can return the
  28424. program to that state.  It is also complete enough to implement
  28425. coroutines.
  28426.  
  28427. Return Value
  28428. ------------
  28429.  
  28430. This function will return zero if it is returning from it's own call.
  28431. If longjmp is used to restore the state, it will return whatever value
  28432. was passed to longjmp, except if zero is passed to longjmp it will
  28433. return one.
  28434.  
  28435. Portability
  28436. -----------
  28437.  
  28438. ANSI, POSIX
  28439.  
  28440. Example
  28441. -------
  28442.  
  28443.      jmp_buf j;
  28444.      if (setjmp(j))
  28445.        return;
  28446.      do_something();
  28447.      longjmp(j, 1);
  28448.  
  28449. 
  28450. File: libc.info,  Node: setlinebuf,  Next: setlocale,  Prev: setjmp,  Up: Alphabetical List
  28451.  
  28452. setlinebuf
  28453. ==========
  28454.  
  28455. Syntax
  28456. ------
  28457.  
  28458.      #include <stdio.h>
  28459.      
  28460.      void setlinebuf(FILE *file);
  28461.  
  28462. Description
  28463. -----------
  28464.  
  28465. This function modifies the buffering characteristics of FILE.  First,
  28466. if the file already has a buffer, it is freed.  If there was any
  28467. pending data in it, it is lost, so this function should only be used
  28468. immediately after a call to `fopen'.
  28469.  
  28470. Next, a buffer is allocated and the file is set to line buffering.
  28471.  
  28472. *Note setbuf::.  *Note setlinebuf::.  *Note setvbuf::.
  28473.  
  28474. Return Value
  28475. ------------
  28476.  
  28477. None.
  28478.  
  28479. Portability
  28480. -----------
  28481.  
  28482. not ANSI, not POSIX
  28483.  
  28484. Example
  28485. -------
  28486.  
  28487.      setlinebuf(stderr);
  28488.  
  28489. 
  28490. File: libc.info,  Node: setlocale,  Next: setmntent,  Prev: setlinebuf,  Up: Alphabetical List
  28491.  
  28492. setlocale
  28493. =========
  28494.  
  28495. Syntax
  28496. ------
  28497.  
  28498.      #include <locale.h>
  28499.      
  28500.      char *setlocale(int category, const char *locale);
  28501.  
  28502. Description
  28503. -----------
  28504.  
  28505. This function sets part or all of the current locale.  The CATEGORY is
  28506. one of the following:
  28507.  
  28508. `LC_ALL'
  28509.      Set all parts of the locale.
  28510.  
  28511. `LC_COLLATE'
  28512.      Set the collating information.
  28513.  
  28514. `LC_CTYPE'
  28515.      Set the character type information.
  28516.  
  28517. `LC_MONETARY'
  28518.      Set the monetary formatting information.
  28519.  
  28520. `LC_NUMERIC'
  28521.      Set the numeric formatting information.
  28522.  
  28523. `LC_TIME'
  28524.      Set the time formatting information.
  28525.  
  28526. The LOCALE should be the name of the current locale.  Currently, only
  28527. the "C" and "POSIX" locales are supported.  If the LOCALE is NULL, no
  28528. action is performed.  If LOCALE is "", the locale is identified by
  28529. environment variables (currently not supported).
  28530.  
  28531. *Note localeconv::.
  28532.  
  28533. Return Value
  28534. ------------
  28535.  
  28536. A static string naming the current locale for the given category, or
  28537. NULL if the requested locale is not supported.
  28538.  
  28539. Portability
  28540. -----------
  28541.  
  28542. ANSI, POSIX
  28543.  
  28544. Example
  28545. -------
  28546.  
  28547.      setlocale(LC_ALL, "C");
  28548.  
  28549. 
  28550. File: libc.info,  Node: setmntent,  Next: setmode,  Prev: setlocale,  Up: Alphabetical List
  28551.  
  28552. setmntent
  28553. =========
  28554.  
  28555. Syntax
  28556. ------
  28557.  
  28558.      #include <mntent.h>
  28559.      
  28560.      FILE *setmntent(char *filename, const char *mode);
  28561.  
  28562. Description
  28563. -----------
  28564.  
  28565. This function returns an open FILE* pointer which can be used by
  28566. getmntent (*note getmntent::.).  The arguments FILENAME and MODE are
  28567. always ignored under MS-DOS, but for portability should be set,
  28568. accordingly, to the name of the file which describes the mounted
  28569. filesystems and the open mode of that file (like the MODE argument to
  28570. `fopen', *note fopen::.).  (There is no single standard for the name of
  28571. the file that keeps the mounted filesystems, but it is usually,
  28572. although not always, listed in the header `<mntent.h>'.)
  28573.  
  28574. Return Value
  28575. ------------
  28576.  
  28577. The `FILE*' pointer is returned.  For MS-DOS, this `FILE*' is not a
  28578. real pointer and may only be used by `getmntent'.
  28579.  
  28580. Portability
  28581. -----------
  28582.  
  28583. not ANSI, not POSIX
  28584.  
  28585. Example
  28586. -------
  28587.  
  28588.      #include <mntent.h>
  28589.      #if defined(MNT_MNTTAB)
  28590.      #define MNTTAB_FILE MNT_MNTTAB
  28591.      #elif defined(MNTTABNAME)
  28592.      #define MNTTAB_FILE MNTTABNAME
  28593.      #else
  28594.      #define MNTTAB_FILE "/etc/mnttab"
  28595.      #endif
  28596.      
  28597.        FILE *mnt_fp = setmntent (MNTTAB_FILE, "r");
  28598.  
  28599. 
  28600. File: libc.info,  Node: setmode,  Next: setpgid,  Prev: setmntent,  Up: Alphabetical List
  28601.  
  28602. setmode
  28603. =======
  28604.  
  28605. Syntax
  28606. ------
  28607.  
  28608.      #include <io.h>
  28609.      
  28610.      int setmode(int file, int mode);
  28611.  
  28612. Description
  28613. -----------
  28614.  
  28615. This function sets the mode of the given FILE to MODE, which is either
  28616. `O_TEXT' or `O_BINARY'.  It will also set the file into either cooked
  28617. or raw mode accordingly, and set any `FILE*' objects that use this file
  28618. into text or binary mode.
  28619.  
  28620. When called to put FILE that refers to the console into binary mode,
  28621. `setmode' will disable the generation of the signals `SIGINT' and
  28622. `SIGQUIT' when you press, respectively, `Ctrl-<C>' and `Ctrl-<\>'
  28623. (`Ctrl-<BREAK>' will still cause `SIGINT'), because many programs that
  28624. use binary reads from the console will also want to get the `^C' and
  28625. `^\' keys.  You can use the  `__djgpp_set_ctrl_c' library function
  28626. (*note __djgpp_set_ctrl_c::.) if you want `Ctrl-<C>' and `Ctrl-<\>' to
  28627. generate signals while console is read in binary mode.
  28628.  
  28629. Note that, for buffered streams (`FILE*'), you must call `fflush'
  28630. (*note fflush::.) before `setmode', or call `setmode' before writing
  28631. anything to the file, for proper operation.
  28632.  
  28633. Return Value
  28634. ------------
  28635.  
  28636. When successful, the function will return the previous mode of the
  28637. given FILE.  In case of failure, -1 is returned and ERRNO is set.
  28638.  
  28639. Portability
  28640. -----------
  28641.  
  28642. not ANSI, not POSIX
  28643.  
  28644. Example
  28645. -------
  28646.  
  28647.      setmode(0, O_BINARY);
  28648.  
  28649. 
  28650. File: libc.info,  Node: setpgid,  Next: setpwent,  Prev: setmode,  Up: Alphabetical List
  28651.  
  28652. setpgid
  28653. =======
  28654.  
  28655. Syntax
  28656. ------
  28657.  
  28658.      #include <unistd.h>
  28659.      
  28660.      int setpgid(pid_t _pid, pid_t _pgid);
  28661.  
  28662. Return Value
  28663. ------------
  28664.  
  28665. -1 (EPERM) if _pgid is not your current pid, else zero.
  28666.  
  28667. Portability
  28668. -----------
  28669.  
  28670. not ANSI, POSIX
  28671.  
  28672. 
  28673. File: libc.info,  Node: setpwent,  Next: setrlimit,  Prev: setpgid,  Up: Alphabetical List
  28674.  
  28675. setpwent
  28676. ========
  28677.  
  28678. Syntax
  28679. ------
  28680.  
  28681.      #include <pwd.h>
  28682.      
  28683.      void setpwent(void);
  28684.  
  28685. Description
  28686. -----------
  28687.  
  28688. This function reinitializes `getpwent' so that scanning will start from
  28689. the start of the list.  *Note getpwent::.
  28690.  
  28691. Return Value
  28692. ------------
  28693.  
  28694. None.
  28695.  
  28696. Portability
  28697. -----------
  28698.  
  28699. not ANSI, not POSIX
  28700.  
  28701. 
  28702. File: libc.info,  Node: setrlimit,  Next: setsid,  Prev: setpwent,  Up: Alphabetical List
  28703.  
  28704. setrlimit
  28705. =========
  28706.  
  28707. Syntax
  28708. ------
  28709.  
  28710.      #include <sys/resource.h>
  28711.      
  28712.      int setrlimit (int rltype, const struct rlimit *rlimitp);
  28713.  
  28714. Description
  28715. -----------
  28716.  
  28717. This function sets new limit pointed to by RLIMITP on the resource
  28718. limit specified by RLTYPE.  Note that currently it always fails.
  28719.  
  28720. Return Value
  28721. ------------
  28722.  
  28723. Zero on success, nonzero on failure.
  28724.  
  28725. Portability
  28726. -----------
  28727.  
  28728. not ANSI, not POSIX
  28729.  
  28730. 
  28731. File: libc.info,  Node: setsid,  Next: setstate,  Prev: setrlimit,  Up: Alphabetical List
  28732.  
  28733. setsid
  28734. ======
  28735.  
  28736. Syntax
  28737. ------
  28738.  
  28739.      #include <unistd.h>
  28740.      
  28741.      pid_t setsid(void);
  28742.  
  28743. Description
  28744. -----------
  28745.  
  28746. This function does not do anything. It exists to assist porting from
  28747. Unix.
  28748.  
  28749. Return Value
  28750. ------------
  28751.  
  28752. Return value of *note getpid::..
  28753.  
  28754. Portability
  28755. -----------
  28756.  
  28757. not ANSI, POSIX
  28758.  
  28759. 
  28760. File: libc.info,  Node: setstate,  Next: settime,  Prev: setsid,  Up: Alphabetical List
  28761.  
  28762. setstate
  28763. ========
  28764.  
  28765. Syntax
  28766. ------
  28767.  
  28768.      #include <stdlib.h>
  28769.      
  28770.      char *setstate(char *arg_state);
  28771.  
  28772. Description
  28773. -----------
  28774.  
  28775. Restores the random number generator (*note random::.) state from
  28776. pointer ARG_STATE to state array.
  28777.  
  28778. Return Value
  28779. ------------
  28780.  
  28781. Pointer to old state information.
  28782.  
  28783. Portability
  28784. -----------
  28785.  
  28786. not ANSI, not POSIX
  28787.  
  28788. 
  28789. File: libc.info,  Node: settime,  Next: settimeofday,  Prev: setstate,  Up: Alphabetical List
  28790.  
  28791. settime
  28792. =======
  28793.  
  28794. Syntax
  28795. ------
  28796.  
  28797.      #include <dos.h>
  28798.      
  28799.      void settime(struct time *ptr);
  28800.  
  28801. Description
  28802. -----------
  28803.  
  28804. This function sets the current time.
  28805.  
  28806. For the description of `struct time', see *Note gettime::.  Also see
  28807. *Note setdate::.
  28808.  
  28809. Return Value
  28810. ------------
  28811.  
  28812. None.
  28813.  
  28814. Portability
  28815. -----------
  28816.  
  28817. not ANSI, not POSIX
  28818.  
  28819. Example
  28820. -------
  28821.  
  28822.      struct time t;
  28823.      settime(&t);
  28824.  
  28825. 
  28826. File: libc.info,  Node: settimeofday,  Next: setuid,  Prev: settime,  Up: Alphabetical List
  28827.  
  28828. settimeofday
  28829. ============
  28830.  
  28831. Syntax
  28832. ------
  28833.  
  28834.      #include <time.h>
  28835.      
  28836.      int settimeofday(struct timeval *tp, ...);
  28837.  
  28838. Description
  28839. -----------
  28840.  
  28841. Sets the current GMT time.  For compatibility, a second argument is
  28842. accepted.  *Note gettimeofday::, for information on the structure types.
  28843.  
  28844. Return Value
  28845. ------------
  28846.  
  28847. Zero if the time was set, nonzero on error.
  28848.  
  28849. Portability
  28850. -----------
  28851.  
  28852. not ANSI, not POSIX
  28853.  
  28854. 
  28855. File: libc.info,  Node: setuid,  Next: setvbuf,  Prev: settimeofday,  Up: Alphabetical List
  28856.  
  28857. setuid
  28858. ======
  28859.  
  28860. Syntax
  28861. ------
  28862.  
  28863.      #include <unistd.h>
  28864.      
  28865.      int setuid(uid_t uid);
  28866.  
  28867. Description
  28868. -----------
  28869.  
  28870. This function is simulated, since MS-DOS does not support user IDs.
  28871.  
  28872. Return Value
  28873. ------------
  28874.  
  28875. If UID is equal to that returned by *note getuid::., returns zero.
  28876. Otherwise, returns -1 and sets `errno' to EPERM.
  28877.  
  28878. Portability
  28879. -----------
  28880.  
  28881. not ANSI, POSIX
  28882.  
  28883. 
  28884. File: libc.info,  Node: setvbuf,  Next: sigaction,  Prev: setuid,  Up: Alphabetical List
  28885.  
  28886. setvbuf
  28887. =======
  28888.  
  28889. Syntax
  28890. ------
  28891.  
  28892.      #include <stdio.h>
  28893.      
  28894.      int setvbuf(FILE *file, char *buffer, int type, int length);
  28895.  
  28896. Description
  28897. -----------
  28898.  
  28899. This function modifies the buffering characteristics of FILE.  First,
  28900. if the file already has a buffer, it is freed.  If there was any
  28901. pending data in it, it is lost, so this function should only be used
  28902. immediately after a call to `fopen'.
  28903.  
  28904. If the TYPE is `_IONBF', the BUFFER and LENGTH are ignored and the file
  28905. is set to unbuffered mode.
  28906.  
  28907. If the TYPE is `_IOLBF' or `_IOFBF', then the file is set to line or
  28908. fully buffered, respectively.  If BUFFER is `NULL', a buffer of size
  28909. SIZE is created and used as the buffer.  If BUFFER is non-`NULL', it
  28910. must point to a buffer of at least size SIZE and will be used as the
  28911. buffer.
  28912.  
  28913. *Note setbuf::.  *Note setbuffer::.  *Note setlinebuf::.
  28914.  
  28915. Return Value
  28916. ------------
  28917.  
  28918. Zero on success, nonzero on failure.
  28919.  
  28920. Portability
  28921. -----------
  28922.  
  28923. ANSI, POSIX
  28924.  
  28925. Example
  28926. -------
  28927.  
  28928.      setvbuf(stderr, NULL, _IOLBF, 1000);
  28929.  
  28930. 
  28931. File: libc.info,  Node: sigaction,  Next: sigaddset,  Prev: setvbuf,  Up: Alphabetical List
  28932.  
  28933. sigaction
  28934. =========
  28935.  
  28936. Syntax
  28937. ------
  28938.  
  28939.      #include <signal.h>
  28940.      
  28941.      int sigaction (int sig, const struct sigaction *act, struct sigaction *oact);
  28942.  
  28943. Description
  28944. -----------
  28945.  
  28946. This function allows to examine and/or change the action associated with
  28947. a signal SIG.  The `struct sigaction' structure, defined by the header
  28948. file `signal.h', is declared as follows:
  28949.  
  28950.       struct sigaction {
  28951.         int sa_flags;             /* flags for the action; currently ignored */
  28952.         void (*sa_handler)(int);  /* the handler for the signal */
  28953.         sigset_t sa_mask;         /* additional signals to be blocked */
  28954.       };
  28955.  
  28956. The `sa_handler' member is a signal handler, see *Note signal::.  The
  28957. `sa_mask' member defines the signals, in addition to SIG, which are to
  28958. be blocked during the execution of `sa_handler'.
  28959.  
  28960. The `sigaction' function sets the structure pointed to by `oact' to the
  28961. current action for the signal SIG, and then sets the new action for SIG
  28962. as specified by ACT.  If the ACT argument is `NULL', `sigaction'
  28963. returns the current signal action in OACT, but doesn't change it.  If
  28964. the OACT argument is a `NULL' pointer, it is ignored.  Thus, passing
  28965. `NULL' pointers for both `act' and `oact' is a way to see if SIG is a
  28966. valid signal number on this system (if not, `sigaction' will return -1
  28967. and set `errno').
  28968.  
  28969. Return Value
  28970. ------------
  28971.  
  28972. 0 on success, -1 for illegal value of SIG.
  28973.  
  28974. Portability
  28975. -----------
  28976.  
  28977. not ANSI, POSIX
  28978.  
  28979. 
  28980. File: libc.info,  Node: sigaddset,  Next: sigdelset,  Prev: sigaction,  Up: Alphabetical List
  28981.  
  28982. sigaddset
  28983. =========
  28984.  
  28985. Syntax
  28986. ------
  28987.  
  28988.      #include <signal.h>
  28989.      
  28990.      int sigaddset (sigset_t *set, int signo)
  28991.  
  28992. Description
  28993. -----------
  28994.  
  28995. This function adds the individual signal specified by SIGNO the set of
  28996. signals pointed to by SET.
  28997.  
  28998. Return Value
  28999. ------------
  29000.  
  29001. 0 upon success, -1 if SET is a NULL pointer, or if SIGNO is specifies
  29002. an unknown signal.
  29003.  
  29004. Portability
  29005. -----------
  29006.  
  29007. not ANSI, POSIX
  29008.  
  29009. 
  29010. File: libc.info,  Node: sigdelset,  Next: sigemptyset,  Prev: sigaddset,  Up: Alphabetical List
  29011.  
  29012. sigdelset
  29013. =========
  29014.  
  29015. Syntax
  29016. ------
  29017.  
  29018.      #include <signal.h>
  29019.      
  29020.      int sigdelset (sigset_t *set, int signo)
  29021.  
  29022. Description
  29023. -----------
  29024.  
  29025. This function removess the individual signal specified by SIGNO from
  29026. the set of signals pointed to by SET.
  29027.  
  29028. Return Value
  29029. ------------
  29030.  
  29031. 0 upon success, -1 if SET is a NULL pointer, or if SIGNO is specifies
  29032. an unknown signal.
  29033.  
  29034. Portability
  29035. -----------
  29036.  
  29037. not ANSI, POSIX
  29038.  
  29039. 
  29040. File: libc.info,  Node: sigemptyset,  Next: sigfillset,  Prev: sigdelset,  Up: Alphabetical List
  29041.  
  29042. sigemptyset
  29043. ===========
  29044.  
  29045. Syntax
  29046. ------
  29047.  
  29048.      #include <signal.h>
  29049.      
  29050.      int sigemptyset (sigset_t *set)
  29051.  
  29052. Description
  29053. -----------
  29054.  
  29055. This function initializes the set of signals pointed to by SET to
  29056. exclude all signals known to the DJGPP runtime system.  Such an empty
  29057. set, if passed to `sigprocmask' (*note sigprocmask::.), will cause all
  29058. signals to be passed immediately to their handlers.
  29059.  
  29060. Return Value
  29061. ------------
  29062.  
  29063. 0 upon success, -1 if SET is a NULL pointer.
  29064.  
  29065. Portability
  29066. -----------
  29067.  
  29068. not ANSI, POSIX
  29069.  
  29070. 
  29071. File: libc.info,  Node: sigfillset,  Next: sigismember,  Prev: sigemptyset,  Up: Alphabetical List
  29072.  
  29073. sigfillset
  29074. ==========
  29075.  
  29076. Syntax
  29077. ------
  29078.  
  29079.      #include <signal.h>
  29080.      
  29081.      int sigfillset (sigset_t *set)
  29082.  
  29083. Description
  29084. -----------
  29085.  
  29086. This function initializes the set of signals pointed to by SET to
  29087. include all signals known to the DJGPP runtime system.  Such a full
  29088. set, if set by `sigprocmask' (*note sigprocmask::.), will cause all
  29089. signals to be blocked from delivery to their handlers.  Note that the
  29090. set returned by this function only includes signals in the range
  29091. `SIGABRT..SIGTRAP'; software interrupts and/or user-defined signals
  29092. aren't included.
  29093.  
  29094. Return Value
  29095. ------------
  29096.  
  29097. 0 upon success, -1 if SET is a NULL pointer.
  29098.  
  29099. Portability
  29100. -----------
  29101.  
  29102. not ANSI, POSIX
  29103.  
  29104. Example
  29105. -------
  29106.  
  29107.  
  29108.        sigset_t full_set, prev_set;
  29109.      
  29110.        sigfillset (&full_set);
  29111.        sigprocmask (SIG_UNBLOCK, &full_set, &prev_set);
  29112.  
  29113. 
  29114. File: libc.info,  Node: sigismember,  Next: siglongjmp,  Prev: sigfillset,  Up: Alphabetical List
  29115.  
  29116. sigismember
  29117. ===========
  29118.  
  29119. Syntax
  29120. ------
  29121.  
  29122.      #include <signal.h>
  29123.      
  29124.      int sigismember (sigset_t *set, int signo)
  29125.  
  29126. Description
  29127. -----------
  29128.  
  29129. This function checks whether the signal specified by SIGNO is a member
  29130. of the set of signals pointed to by SET.
  29131.  
  29132. Return Value
  29133. ------------
  29134.  
  29135. 1 if the specified signal is a member of the set, 0 if it isn't, or if
  29136. SIGNO specifies an unknown signal, -1 if SET is a NULL pointer.
  29137.  
  29138. Portability
  29139. -----------
  29140.  
  29141. not ANSI, POSIX
  29142.  
  29143. 
  29144. File: libc.info,  Node: siglongjmp,  Next: signal,  Prev: sigismember,  Up: Alphabetical List
  29145.  
  29146. siglongjmp
  29147. ==========
  29148.  
  29149. Syntax
  29150. ------
  29151.  
  29152.      #include <setjmp.h>
  29153.      
  29154.      int    siglongjmp(sigjmp_buf env, int val);
  29155.  
  29156. Description
  29157. -----------
  29158.  
  29159. *Note longjmp::.
  29160.  
  29161. Portability
  29162. -----------
  29163.  
  29164. not ANSI, POSIX
  29165.  
  29166. 
  29167. File: libc.info,  Node: signal,  Next: sigpending,  Prev: siglongjmp,  Up: Alphabetical List
  29168.  
  29169. signal
  29170. ======
  29171.  
  29172. Syntax
  29173. ------
  29174.  
  29175.      #include <signal.h>
  29176.      
  29177.      void    (*signal(int sig, void (*func)(int)))(int);
  29178.  
  29179. Description
  29180. -----------
  29181.  
  29182. Signals are generated in response to some exceptional behavior of the
  29183. program, such as division by 0.  A signal can also report some
  29184. asynchronous event outside the program, such as someone pressing a
  29185. `Ctrl-<BREAK>' key combination.
  29186.  
  29187. Signals are numbered 0..255 for software interrupts and 256..287 for
  29188. exceptions (exception number plus 256); other implementation-specific
  29189. codes are specified in `<signal.h>' (see below).  Every signal is given
  29190. a mnemonic which you should use for portable programs.
  29191.  
  29192. By default, signal `SIGQUIT' is discarded.  This is so programs ported
  29193. from other DOS environments, where `SIGQUIT' is generally not
  29194. supported, continue to work as they originally did.  If you want
  29195. `SIGQUIT' to abort with a traceback, install `__djgpp_traceback_exit'
  29196. as its handler (*note __djgpp_traceback_exit::.).
  29197.  
  29198. The default handling for the rest of the signals is to print a
  29199. traceback (a stack dump which describes the sequence of function calls
  29200. leading to the generation of the signal) and abort the program by
  29201. calling `_exit' (*note _exit::.).  As an exception, the default handler
  29202. for the signal `SIGINT' doesn't print the traceback, and calls `exit'
  29203. instead of `_exit', when the INTR key (`Ctrl-C' by default) is pressed,
  29204. so that programs could be shut down safely in this manner.  `SIGINT'
  29205. raised by `Ctrl-<BREAK>' does generate the traceback.
  29206.  
  29207. The function `signal' allows you to change the default behavior for a
  29208. specific signal.  It registers FUNC as a signal handler for signal
  29209. number SIG.  After you register your function as the handler for a
  29210. particular signal, it will be called when that signal occurs.  The
  29211. execution of the program will be suspended until the handler returns or
  29212. calls `longjmp' (*note longjmp::.).
  29213.  
  29214. You may pass `SIG_DFL' as the value of FUNC to reset the signal
  29215. handling for the signal SIG to default (also *Note
  29216. __djgpp_exception_toggle::, for a quick way to restore all the signals'
  29217. handling to default), `SIG_ERR' to force an error when that signal
  29218. happens, or `SIG_IGN' to ignore that signal.  Signal handlers that you
  29219. write are regular C functions, and may call any function that the
  29220. ANSI/POSIX specs say are valid for signal handlers.  For maximum
  29221. portability, a handler for hardware interrupts and processor exceptions
  29222. should only make calls to `signal', assign values to data objects of
  29223. type `volatile sig_atomic_t' (defined as `int' on `<signal.h>') and
  29224. return.  Handlers for hardware interrupts need also be locked in memory
  29225. (so that the operation of virtual memory mechanism won't swap them
  29226. out), *Note locking memory regions: __dpmi_lock_linear_region.
  29227. Handlers for software interrupts can also terminate by calling `abort',
  29228. `exit' or `longjmp'.
  29229.  
  29230. The following signals are defined on `<signal.h>':
  29231.  
  29232. `SIGABRT'
  29233.      The Abort signal.  Currently only used by the `assert' macro to
  29234.      terminate the program when an assertion fails (*note assert::.),
  29235.      and by the `abort' function (*note abort::.).
  29236.  
  29237. `SIGFPE'
  29238.      The Floating Point Error signal.  Generated in case of divide by
  29239.      zero exception (Int 00h), overflow exception (Int 04h), and any x87
  29240.      co-processor exception, either generated by the CPU (Int 10h), or
  29241.      by the co-processor itself (Int 75h).  The co-processor status
  29242.      word is printed by the default handler for this signal.  *Note
  29243.      _status87::, for the definition of the individual bits of the
  29244.      status word.
  29245.  
  29246.      The DJGPP startup code masks all numeric exceptions, so this
  29247.      signal is usually only triggered by an integer divide by zero
  29248.      operation.  If you want to unmask some of the numeric exceptions,
  29249.      see *Note _control87::.
  29250.  
  29251. `SIGILL'
  29252.      The Invalid Execution signal.  Currently only generated for
  29253.      unknown/invalid exceptions.
  29254.  
  29255. `SIGINT'
  29256.      The Interrupt signal.  Generated when an INTR key (`Ctrl-C' by
  29257.      default) or `Ctrl-<BREAK>' (Int 1Bh) key is hit.  Note that when
  29258.      you open the console in binary mode, or switch it to binary mode
  29259.      by a call to `setmode' (*note setmode::.), generation of `SIGINT'
  29260.      as result of `Ctrl-C' key is disabled.  This is so for programs
  29261.      (such as Emacs) which want to be able to read the `^C' character
  29262.      as any other character.  Use the library function
  29263.      `__djgpp_set_ctrl_c' to restore `SIGINT' generation when `Ctrl-C'
  29264.      is hit, if you need this.  *Note __djgpp_set_ctrl_c::, for details
  29265.      on how this should be done.  `Ctrl-<BREAK>' always generates
  29266.      `SIGINT'.
  29267.  
  29268.      DJGPP hooks the keyboard hardware interrupt (Int 09h) to be able to
  29269.      generate `SIGINT' in response to the INTR key; you should be aware
  29270.      of this when you install a handler for the keyboard interrupt.
  29271.  
  29272.      Note that the key which generates `SIGINT' can be changed with a
  29273.      call to `__djgpp_set_sigint_key' function.  *Note
  29274.      __djgpp_set_sigint_key::.
  29275.  
  29276. `SIGSEGV'
  29277.      The invalid storage access (Segmentation Violation) signal.
  29278.      Generated in response to any of the following exceptions: Bound
  29279.      range exceeded in BOUND instruction (Int 05h), Double Exception or
  29280.      an exception in the exception handler (Int 08h), Segment Boundary
  29281.      violation by co-processor (Int 09h), Invalid TSS (Int 0Ah),
  29282.      Segment Not Present (Int 0Bh), Stack Fault (Int 0Ch), General
  29283.      Protection Violation (Int 0Dh), or Page Fault (Int 0Eh).  Note
  29284.      that Int 09h is only generated on 80386 processor; i486 and later
  29285.      CPUs cause Int 0Dh when the co-processor accesses memory out of
  29286.      bounds.  The Double Exception, Invalid TSS, Segment Not Present,
  29287.      Stack Fault, GPF, and Page Fault exceptions will cause an error
  29288.      code to be printed, if it is non-zero.
  29289.  
  29290. `SIGTERM'
  29291.      The Termination Request signal.  Currently unused.
  29292.  
  29293.      The signals below this are not defined by ANSI C, and cannot be
  29294.      used when compiling under `-ansi' option to `gcc'.
  29295.  
  29296. `SIGALRM'
  29297.      The Alarm signal.  Generated after certain time period has passed
  29298.      after a call to `alarm' library function (*note alarm::.).
  29299.  
  29300. `SIGHUP'
  29301.      The Hang-up signal.  Currently unused.
  29302.  
  29303. `SIGKILL'
  29304.      The Kill signal.  Currently unused.
  29305.  
  29306. `SIGPIPE'
  29307.      The Broken Pipe signal.  Currently unused.
  29308.  
  29309. `SIGQUIT'
  29310.      The Quit signal.  Generated when the QUIT key (`Ctrl-\' by default)
  29311.      is hit.  The key that raises the signal can be changed with a call
  29312.      to `__djgpp_set_sigquit_key' function.  *Note
  29313.      __djgpp_set_sigquit_key::.  By default, `SIGQUIT' is discarded,
  29314.      even if its handler is `SIG_DFL', so that DOS programs which don't
  29315.      expect it do not break.  You can change the effect of `SIGQUIT' to
  29316.      abort with traceback by installing `__djgpp_traceback_exit' as its
  29317.      handler.  *Note __djgpp_traceback_exit::.
  29318.  
  29319.      DJGPP hooks the keyboard hardware interrupt (Int 09h) to be able to
  29320.      generate `SIGQUIT' in response to the QUIT key; you should be
  29321.      aware of this when you install a handler for the keyboard
  29322.      interrupt.
  29323.  
  29324. `SIGUSR1'
  29325.      User-defined signal no. 1.
  29326.  
  29327. `SIGUSR2'
  29328.      User-defined signal no. 2.
  29329.  
  29330.      The signals below are not defined by ANSI C and POSIX, and cannot
  29331.      be used when compiling under either `-ansi' or `-posix' options to
  29332.      `gcc'.
  29333.  
  29334. `SIGTRAP'
  29335.      The Trap Instruction signal.  Generated in response to the Debugger
  29336.      Exception (Int 01h) or Breakpoint Exception (Int 03h).
  29337.  
  29338. `SIGNOFP'
  29339.      The No Co-processor signal.  Generated if a co-processor
  29340.      (floating-point) instruction is encountered when no co-processor
  29341.      is installed (Int 07h).
  29342.  
  29343. `SIGTIMR'
  29344.      The Timer signal.  Used by the `setitimer' and `alarm' functions
  29345.      (*Note setitimer::, and *note alarm::.).
  29346.  
  29347. `SIGPROF'
  29348.      The Profiler signal.  Used by the execution profile gathering code
  29349.      in a program compiled with `-pg' option to `gcc'.
  29350.  
  29351. Return Value
  29352. ------------
  29353.  
  29354. The previous handler for signal SIG, or `SIG_ERR' if the value of SIG
  29355. is outside legal limits.
  29356.  
  29357. Signal Mechanism Implementation Notes
  29358. -------------------------------------
  29359.  
  29360. Due to subtle aspects of protected-mode programs operation under MS-DOS,
  29361. signal handlers cannot be safely called from hardware interrupt
  29362. handlers.  Therefore, DJGPP exception-handling mechanism arranges for
  29363. the signal handler to be called on the first occasion that the program
  29364. is in protected mode and touches any of its data.  This means that if
  29365. the exception occurs while the processor is in real mode, like when your
  29366. program calls some DOS service, the signal handler won't be called until
  29367. that call returns.  For instance, if you call `read' (or `scanf', or
  29368. `gets') to read text from the console and press `Ctrl-C', you will have
  29369. to press `Enter' to terminate the `read' call to cause the signal
  29370. handler for `SIGINT' to be called.  Another significant implication of
  29371. this implementation is that when the program isn't touching any of its
  29372. data (like in very tight loops which only use values in the registers),
  29373. it cannot be interrupted.
  29374.  
  29375. Portability
  29376. -----------
  29377.  
  29378. ANSI, POSIX
  29379.  
  29380. 
  29381. File: libc.info,  Node: sigpending,  Next: sigprocmask,  Prev: signal,  Up: Alphabetical List
  29382.  
  29383. sigpending
  29384. ==========
  29385.  
  29386. Syntax
  29387. ------
  29388.  
  29389.      #include <signal.h>
  29390.      
  29391.      int sigpending (sigset_t *set)
  29392.  
  29393. Description
  29394. -----------
  29395.  
  29396. This function retrieves the signals that have been sent to the program,
  29397. but are being blocked from delivery by the program's signal mask (*note
  29398. sigprocmask::.).  The bit-mapped value which describes the pending
  29399. signals is stored in the structure pointed to by SET.  You can use the
  29400. `sigismember' function (*note sigismember::.) to see what individual
  29401. signals are pending.
  29402.  
  29403. Return Value
  29404. ------------
  29405.  
  29406. 0 on success, -1 on failure (and errno set to `EFAULT').
  29407.  
  29408. Portability
  29409. -----------
  29410.  
  29411. not ANSI, POSIX
  29412.  
  29413. Example
  29414. -------
  29415.  
  29416.  
  29417.      #include <signal.h>
  29418.      
  29419.        sigset_t pending_signals;
  29420.      
  29421.        /* If SIGINT is pending, force it to be raised.  */
  29422.        if (sigpending (&pending_signals) == 0
  29423.            && sigismember (&pending_signals, SIGINT))
  29424.          {
  29425.            sigset_t new_set, old_set;
  29426.            sigemptyset (&new_set);
  29427.            sigaddset (&new_set, SIGINT);
  29428.            sigprocmask (SIG_UNBLOCK, &new_set, &old_set);  /* will raise SIGINT */
  29429.            sigprocmask (SIG_SETMASK, &old_set, &new_set);  /* restore mask */
  29430.          }
  29431.  
  29432. 
  29433. File: libc.info,  Node: sigprocmask,  Next: sigsetjmp,  Prev: sigpending,  Up: Alphabetical List
  29434.  
  29435. sigprocmask
  29436. ===========
  29437.  
  29438. Syntax
  29439. ------
  29440.  
  29441.      #include <signal.h>
  29442.      
  29443.      int sigprocmask (int how, const sigset_t *new_set, sigset_t *old_set)
  29444.  
  29445. Description
  29446. -----------
  29447.  
  29448. This function is used to examine and/or change the program's current
  29449. signal mask.  The current signal mask determines which signals are
  29450. blocked from being delivered to the program.  A signal is blocked if its
  29451. bit in the mask is set.  (*Note sigismember::, *Note sigaddset::, *Note
  29452. sigdelset::, *Note sigemptyset::, *Note sigfillset::, for information
  29453. about functions to manipulate the signal masks.)  When a blocked signal
  29454. happens, it is not delivered to the program until such time as that
  29455. signal is unblocked by another call to `sigprocmask'.  Thus blocking a
  29456. signal is an alternative to ignoring it (by setting its handler to
  29457. `SIG_IGN', *note signal::.), but has an advantage of not missing the
  29458. signal entirely.
  29459.  
  29460. The value of the argument HOW determines the operation: if it is
  29461. `SIG_BLOCK', the set pointed to by the argument NEW_SET is *added* to
  29462. the current signal mask.  If the value is `SIG_UNBLOCK', the set
  29463. pointed to by NEW_SET is *removed* from the current signal mask.  If
  29464. the value is `SIG_SETMASK', the current mask is *replaced* by the set
  29465. pointed to by NEW_SET.
  29466.  
  29467. If the argument OLD_SET is not `NULL', the previous mask is stored in
  29468. the space pointed to by OLD_SET.  If the value of the argument NEW_SET
  29469. is `NULL', the value of HOW is not significant and the process signal
  29470. mask is unchanged; thus, the call with a zero NEW_SET can be used to
  29471. inquire about currently blocked signals, without changing the current
  29472. set.
  29473.  
  29474. If the new set defined by the call causes some pending signals to be
  29475. unblocked, they are all delivered (by calling `raise') before the call
  29476. to `sigprocmask' returns.
  29477.  
  29478. The DJGPP implementation only records a single occurrence of any given
  29479. signal, so when the signal is unblocked, its handler will be called at
  29480. most once.
  29481.  
  29482. It is not possible to block CPU exceptions such as Page Fault, General
  29483. Protection Fault etc. (mapped to `SIGSEGV' signal); for these,
  29484. `sigprocmask' will behave as if the call succeeded, but when an
  29485. exception happens, the signal handler will be called anyway (the default
  29486. handler will abort the program).
  29487.  
  29488. Also note that there are no provisions to save and restore any
  29489. additional info about the signal beyond the fact that it happened.  A
  29490. signal handler might need such info to handle the signal intelligently.
  29491. For example, a handler for `SIGFPE' might need to examine the status
  29492. word of the FPU to see what exactly went wrong.  But if the signal was
  29493. blocked and is delivered after a call to `sigprocmask' has unblocked
  29494. it, that information is lost.  Therefore, if you need access to such
  29495. auxiliary information in the signal handler, don't block that signal.
  29496.  
  29497. Return Value
  29498. ------------
  29499.  
  29500. 0 on success, -1 for illegal value of SIG or illegal address in NEW_SET
  29501. or OLD_SET.
  29502.  
  29503. Portability
  29504. -----------
  29505.  
  29506. not ANSI, POSIX
  29507.  
  29508. Example
  29509. -------
  29510.  
  29511.  
  29512.      #include <conio.h>
  29513.      #include <signal.h>
  29514.      
  29515.      static void
  29516.      sig_catcher (int signo)
  29517.      {
  29518.        cprintf ("\r\nGot signal %d\r\n", signo);
  29519.      }
  29520.      
  29521.      int
  29522.      main (void)
  29523.      {
  29524.        sigset_t sigmask, prevmask;
  29525.      
  29526.        signal (SIGINT, sig_catcher);
  29527.      
  29528.        sigemptyset (&sigmask);
  29529.      
  29530.        sigaddset (&sigmask, SIGINT);
  29531.        if (sigprocmask (SIG_SETMASK, &sigmask, &prevmask) == 0)
  29532.          cputs ("SIGINT blocked.  Try to interrupt me now.\r\n");
  29533.        while (!kbhit ())
  29534.          ;
  29535.        cputs ("See?  I wasn't interrupted.\r\n");
  29536.        cputs ("But now I will unblock SIGINT, and then get the signal.\r\n");
  29537.        sigprocmask (SIG_UNBLOCK, &sigmask, &prevmask);
  29538.        return 0;
  29539.      }
  29540.  
  29541. 
  29542. File: libc.info,  Node: sigsetjmp,  Next: sin,  Prev: sigprocmask,  Up: Alphabetical List
  29543.  
  29544. sigsetjmp
  29545. =========
  29546.  
  29547. Syntax
  29548. ------
  29549.  
  29550.      #include <setjmp.h>
  29551.      
  29552.      int    sigsetjmp(sigjmp_buf env, int savemask);
  29553.  
  29554. Description
  29555. -----------
  29556.  
  29557. *Note setjmp::.
  29558.  
  29559. Portability
  29560. -----------
  29561.  
  29562. not ANSI, POSIX
  29563.  
  29564. 
  29565. File: libc.info,  Node: sin,  Next: sincos,  Prev: sigsetjmp,  Up: Alphabetical List
  29566.  
  29567. sin
  29568. ===
  29569.  
  29570. Syntax
  29571. ------
  29572.  
  29573.      #include <math.h>
  29574.      
  29575.      double sin(double x);
  29576.  
  29577. Description
  29578. -----------
  29579.  
  29580. This function computes the sine of X (which should be given in radians).
  29581.  
  29582. Return Value
  29583. ------------
  29584.  
  29585. The sine of X.  If the absolute value of X is finite but greater than
  29586. or equal to 2^63, the value is 0 (since for arguments that large each
  29587. bit of the mantissa is more than `Pi').  If the value of X is infinite
  29588. or `NaN', the return value is `NaN' and `errno' is set to `EDOM'.
  29589.  
  29590. Portability
  29591. -----------
  29592.  
  29593. ANSI, POSIX
  29594.  
  29595. Accuracy
  29596. --------
  29597.  
  29598. In general, this function's relative accuracy is about 1.7*10^(-16),
  29599. which is close to the machine precision for a `double'.  However, for
  29600. arguments very close to `Pi' and its odd multiples, the relative
  29601. accuracy can be many times worse, due to loss of precision in the
  29602. internal FPU computations.  Since sin(Pi) is zero, the absolute
  29603. accuracy is still very good; but if your program needs to preserve high
  29604. *relative* accuracy for such arguments, link with `-lm' and use the
  29605. version of `sin' from `libm.a' which does elaborate argument reduction,
  29606. but is about three times slower.
  29607.  
  29608. 
  29609. File: libc.info,  Node: sincos,  Next: sinh,  Prev: sin,  Up: Alphabetical List
  29610.  
  29611. sincos
  29612. ======
  29613.  
  29614. Syntax
  29615. ------
  29616.  
  29617.      #include <math.h>
  29618.      
  29619.      void   sincos(double *cosine, double *sine, double x);
  29620.  
  29621. Description
  29622. -----------
  29623.  
  29624. This function computes the cosine and the sine of X in a single call,
  29625. and stores the results in the addresses pointed to by COSINE and SINE,
  29626. respectively.  Since the function exploits a machine instruction that
  29627. computes both cosine and sine simultaneously, it is faster to call
  29628. `sincos' than to call `cos' and `sin' for the same argument.
  29629.  
  29630. If the absolute value of X is finite but greater than or equal to 2^63,
  29631. the value stored in *COSINE is 1 and the value stored in *SINE is 0
  29632. (since for arguments that large each bit of the mantissa is more than
  29633. `Pi').  If the value of X is infinite or `NaN', `NaN' is stored in both
  29634. *COSINE and *SINE, and `errno' is set to `EDOM'.
  29635.  
  29636. Return Value
  29637. ------------
  29638.  
  29639. None.
  29640.  
  29641. Portability
  29642. -----------
  29643.  
  29644. not ANSI, not POSIX
  29645.  
  29646. 
  29647. File: libc.info,  Node: sinh,  Next: sleep,  Prev: sincos,  Up: Alphabetical List
  29648.  
  29649. sinh
  29650. ====
  29651.  
  29652. Syntax
  29653. ------
  29654.  
  29655.      #include <math.h>
  29656.      
  29657.      double sinh(double x);
  29658.  
  29659. Description
  29660. -----------
  29661.  
  29662. This function computes the hyperbolic sine of X.
  29663.  
  29664. Return Value
  29665. ------------
  29666.  
  29667. The hyperbolic sine of X.  If the absolute value of X is finite but so
  29668. large that the result would overflow a `double', the return value is
  29669. `Inf' with the same sign as X, and `errno' is set to `ERANGE'.  If X is
  29670. either a positive or a negative infinity, the result is `+Inf' with the
  29671. same sign as X, and `errno' is not changed.  If X is `NaN', the return
  29672. value is `NaN' and `errno' is set to `EDOM'.
  29673.  
  29674. Portability
  29675. -----------
  29676.  
  29677. ANSI, POSIX
  29678.  
  29679. 
  29680. File: libc.info,  Node: sleep,  Next: sound,  Prev: sinh,  Up: Alphabetical List
  29681.  
  29682. sleep
  29683. =====
  29684.  
  29685. Syntax
  29686. ------
  29687.  
  29688.      #include <unistd.h>
  29689.      
  29690.      unsigned sleep(unsigned seconds);
  29691.  
  29692. Description
  29693. -----------
  29694.  
  29695. This function causes the program to pause for SECONDS seconds.
  29696.  
  29697. Return Value
  29698. ------------
  29699.  
  29700. The number of seconds that haven't passed (i.e. always zero)
  29701.  
  29702. Portability
  29703. -----------
  29704.  
  29705. not ANSI, POSIX
  29706.  
  29707. Example
  29708. -------
  29709.  
  29710.      sleep(5);
  29711.  
  29712. 
  29713. File: libc.info,  Node: sound,  Next: spawn*,  Prev: sleep,  Up: Alphabetical List
  29714.  
  29715. sound
  29716. =====
  29717.  
  29718. Syntax
  29719. ------
  29720.  
  29721.      #include <pc.h>
  29722.      
  29723.      void        sound(int _frequency);
  29724.  
  29725. Description
  29726. -----------
  29727.  
  29728. Enables the PC speaker at the given frequency.  The argument _FREQUENCY
  29729. should be given in Hertz units.
  29730.  
  29731. Portability
  29732. -----------
  29733.  
  29734. not ANSI, not POSIX
  29735.  
  29736. 
  29737. File: libc.info,  Node: spawn*,  Next: sprintf,  Prev: sound,  Up: Alphabetical List
  29738.  
  29739. spawn*
  29740. ======
  29741.  
  29742. Syntax
  29743. ------
  29744.  
  29745.      #include <process.h>
  29746.      
  29747.      int spawnl(int mode, const char *path, const char *argv0, ..., NULL);
  29748.      int spawnle(int mode, const char *path, const char *argv0, ..., NULL /*, const char **envp */);
  29749.      int spawnlp(int mode, const char *path, const char *argv0, ..., NULL);
  29750.      int spawnlpe(int mode, const char *path, const char *argv0, ..., NULL /*, const char **envp */);
  29751.      
  29752.      int spawnv(int mode, const char *path, const char **argv);
  29753.      int spawnve(int mode, const char *path, const char **argv, const char **envp);
  29754.      int spawnvp(int mode, const char *path, const char **argv);
  29755.      int spawnvpe(int mode, const char *path, const char **argv, const char **envp);
  29756.  
  29757. Description
  29758. -----------
  29759.  
  29760. These functions run other programs.  The PATH points to the program to
  29761. run, and may optionally include its extension.  These functions will
  29762. look for a file PATH with the extensions `.com', `.exe', `.bat',
  29763. `.btm', `.sh', `.ksh', `.pl' and `.sed'; if none is found, neither in
  29764. the current directory nor along the `PATH', they will look for PATH
  29765. itself.
  29766.  
  29767. `.com' programs are invoked via the usual DOS calls; DJGPP `.exe'
  29768. programs are invoked in a way that allows long command lines to be
  29769. passed; other `.exe' programs are invoked via DOS; `.bat' and `.btm'
  29770. programs are invoked via the command processor given by the `COMSPEC'
  29771. environment variable; `.sh', `.ksh' programs and programs with any
  29772. other extensions that have `#!' as their first two characters are
  29773. assumed to be Unix-style scripts and are invoked by calling a program
  29774. whose pathname immediately follows the first two characters.  (If the
  29775. name of that program is a Unix-style pathname, without a drive letter
  29776. and without an extension, like `/bin/sh', the `spawn' functions will
  29777. additionally look them up on the `PATH'; this allows to run Unix
  29778. scripts without editing, if you have a shell installed somewhere along
  29779. your `PATH'.)  Any non-recognizable files will be also invoked via DOS
  29780. calls.
  29781.  
  29782. *WARNING!*  DOS is rather stupid in invoking programs: if the file
  29783. doesn't have the telltale "MZ" signature of the `.exe' style programs,
  29784. DOS assumes it is a `.com' style image and tries to execute it
  29785. directly.  If the file is not really an executable program, your
  29786. application will almost certainly crash.  Applications that need to be
  29787. robust in such situations should test whether the program file is
  29788. indeed an executable, e.g. with calls to `stat' (*note stat::.) or
  29789. `_is_executable' (*note _is_executable::.) library functions.
  29790.  
  29791. Note that built-in commands of the shells can *not* be invoked via
  29792. these functions; use `system' instead, or invoke the appropriate shell
  29793. with the built-in command as its argument.
  29794.  
  29795. The programs are invoked with the arguments given.  The zeroth argument
  29796. is normally not used, since MS-DOS cannot pass it separately, but for
  29797. compatibility it should be the name of the program.  There are two ways
  29798. of passing arguments.  The `l' functions (like `spawnl') take a list of
  29799. arguments, with a `NULL' at the end of the list.  This is useful when
  29800. you know how many argument there will be ahead of time.  The `v'
  29801. functions (like `spawnv') take a pointer to a list of arguments, which
  29802. also must be `NULL'-terminated.  This is useful when you need to
  29803. compute the number of arguments at runtime.
  29804.  
  29805. In either case, you may also specify `e' to indicate that you will be
  29806. giving an explicit environment, else the current environment is used.
  29807. You may also specify `p' to indicate that you would like `spawn*' to
  29808. search the `PATH' (in either the environment you pass or the current
  29809. environment) for the executable, else it will only check the explicit
  29810. path given.
  29811.  
  29812. Note that these function understand about other DJGPP programs, and will
  29813. call them directly, so that you can pass command lines longer than 126
  29814. characters to them without any special code.  DJGPP programs called by
  29815. these functions will *not* glob the arguments passed to them; other
  29816. programs also won't glob the arguments if they suppress expansion when
  29817. given quoted filenames.
  29818.  
  29819. *Note exec*::.
  29820.  
  29821. Return Value
  29822. ------------
  29823.  
  29824. If successful and `mode' is `P_WAIT', these functions return the exit
  29825. code of the child process in the lower 8 bits of the return value.
  29826. Note that if the program is run by a command processor (e.g., if it's a
  29827. batch file), the exit code of that command processor will be returned.
  29828. `COMMAND.COM' is notorious for returning 0 even if it couldn't run the
  29829. command.
  29830.  
  29831. If successful and MODE is `P_OVERLAY', these functions will not return.
  29832.  
  29833. If there is an error (e.g., the program specified as `argv[0]' cannot
  29834. be run, or the command line is too long), these functions return -1 and
  29835. set `errno' to indicate the error.  If the child program was
  29836. interrupted by <Ctrl-C> or a Critical Device error, `errno' is set to
  29837. `EINTR' (even if the child's exit code is 0), and bits 8-17 of the
  29838. return value are set to `SIGINT' or `SIGABRT', accordingly.  Note that
  29839. you must set the signal handler for `SIGINT' to `SIG_IGN', or arrange
  29840. for the handler to return, or else your program will be aborted before
  29841. it will get chance to set the value of the return code.
  29842.  
  29843. Portability
  29844. -----------
  29845.  
  29846. not ANSI, not POSIX
  29847.  
  29848. Example
  29849. -------
  29850.  
  29851.  
  29852.      char *environ[] = {
  29853.        "PATH=c:\\dos;c:\\djgpp;c:\\usr\\local\\bin",
  29854.        "DJGPP=c:/djgpp",
  29855.        0
  29856.      };
  29857.      
  29858.      char *args[] = {
  29859.        "gcc",
  29860.        "-v",
  29861.        "hello.c",
  29862.        0
  29863.      };
  29864.      
  29865.      spawnvpe(P_WAIT, "gcc", args, environ);
  29866.  
  29867. 
  29868. File: libc.info,  Node: sprintf,  Next: sqrt,  Prev: spawn*,  Up: Alphabetical List
  29869.  
  29870. sprintf
  29871. =======
  29872.  
  29873. Syntax
  29874. ------
  29875.  
  29876.      #include <stdio.h>
  29877.      
  29878.      int sprintf(char *buffer, const char *format, ...);
  29879.  
  29880. Description
  29881. -----------
  29882.  
  29883. Sends formatted output from the arguments (...) to the BUFFER.  *Note
  29884. printf::.
  29885.  
  29886. Return Value
  29887. ------------
  29888.  
  29889. The number of characters written.
  29890.  
  29891. Portability
  29892. -----------
  29893.  
  29894. ANSI, POSIX
  29895.  
  29896. 
  29897. File: libc.info,  Node: sqrt,  Next: srand,  Prev: sprintf,  Up: Alphabetical List
  29898.  
  29899. sqrt
  29900. ====
  29901.  
  29902. Syntax
  29903. ------
  29904.  
  29905.      #include <math.h>
  29906.      
  29907.      double sqrt(double x);
  29908.  
  29909. Description
  29910. -----------
  29911.  
  29912. This function computes the square root of X.
  29913.  
  29914. Return Value
  29915. ------------
  29916.  
  29917. The square root of X.  If X is negative or a `NaN', the return value is
  29918. `NaN' and `errno' is set to `EDOM'.
  29919.  
  29920. Portability
  29921. -----------
  29922.  
  29923. ANSI, POSIX
  29924.  
  29925. 
  29926. File: libc.info,  Node: srand,  Next: srandom,  Prev: sqrt,  Up: Alphabetical List
  29927.  
  29928. srand
  29929. =====
  29930.  
  29931. Syntax
  29932. ------
  29933.  
  29934.      #include <stdlib.h>
  29935.      
  29936.      void srand(unsigned seed);
  29937.  
  29938. Description
  29939. -----------
  29940.  
  29941. Initializes the random number generator for `rand()'.  If you pass the
  29942. same seed, `rand()' will return the same sequence of numbers.  You can
  29943. seed from *Note time:: or *Note rawclock::.
  29944.  
  29945. Portability
  29946. -----------
  29947.  
  29948. ANSI, POSIX
  29949.  
  29950. Example
  29951. -------
  29952.  
  29953.      /* random pause */
  29954.      srand(time(0));
  29955.      for (i=rand(); i; i--);
  29956.  
  29957. 
  29958. File: libc.info,  Node: srandom,  Next: sscanf,  Prev: srand,  Up: Alphabetical List
  29959.  
  29960. srandom
  29961. =======
  29962.  
  29963. Syntax
  29964. ------
  29965.  
  29966.      #include <stdlib.h>
  29967.      
  29968.      int srandom(int seed);
  29969.  
  29970. Description
  29971. -----------
  29972.  
  29973. Initializes the random number generator (*note random::.). Passing the
  29974. same SEED results in `random' returning predictable sequences of
  29975. numbers, unless *note initstate::. or *note setstate::. are called.
  29976.  
  29977. Return Value
  29978. ------------
  29979.  
  29980. Zero.
  29981.  
  29982. Portability
  29983. -----------
  29984.  
  29985. not ANSI, not POSIX
  29986.  
  29987. Example
  29988. -------
  29989.  
  29990.      srandom(45);
  29991.  
  29992. 
  29993. File: libc.info,  Node: sscanf,  Next: stackavail,  Prev: srandom,  Up: Alphabetical List
  29994.  
  29995. sscanf
  29996. ======
  29997.  
  29998. Syntax
  29999. ------
  30000.  
  30001.      #include <stdio.h>
  30002.      
  30003.      int sscanf(const char *string, const char *format, ...);
  30004.  
  30005. Description
  30006. -----------
  30007.  
  30008. This function scans formatted text from the STRING and stores it in the
  30009. variables pointed to by the arguments.  *Note scanf::.
  30010.  
  30011. Return Value
  30012. ------------
  30013.  
  30014. The number of items successfully scanned.
  30015.  
  30016. Portability
  30017. -----------
  30018.  
  30019. ANSI, POSIX
  30020.  
  30021. 
  30022. File: libc.info,  Node: stackavail,  Next: stat,  Prev: sscanf,  Up: Alphabetical List
  30023.  
  30024. stackavail
  30025. ==========
  30026.  
  30027. Syntax
  30028. ------
  30029.  
  30030.      #include <stdlib.h>
  30031.      
  30032.      int stackavail(void);
  30033.  
  30034. Description
  30035. -----------
  30036.  
  30037. This function returns the number of bytes that are available on the
  30038. stack.
  30039.  
  30040. Portability
  30041. -----------
  30042.  
  30043. not ANSI, not POSIX
  30044.  
  30045. Example
  30046. -------
  30047.  
  30048.      printf("Available stack size is %d bytes\n", stackavail());
  30049.  
  30050. 
  30051. File: libc.info,  Node: stat,  Next: statfs,  Prev: stackavail,  Up: Alphabetical List
  30052.  
  30053. stat
  30054. ====
  30055.  
  30056. Syntax
  30057. ------
  30058.  
  30059.      #include <sys/stat.h>
  30060.      
  30061.      int stat(const char *file, struct stat *sbuf);
  30062.  
  30063. Description
  30064. -----------
  30065.  
  30066. This function obtains the status of the file FILE and stores it in
  30067. SBUF, which has this structure:
  30068.  
  30069.      struct  stat {
  30070.              time_t   st_atime;     /* time of last access       */
  30071.              time_t   st_ctime;     /* time of file's creation   */
  30072.              dev_t    st_dev;       /* The drive number (0 = a:) */
  30073.              gid_t    st_gid;       /* what getgid() returns */
  30074.              ino_t    st_ino;       /* starting cluster or unique identifier */
  30075.              mode_t   st_mode;      /* file mode - S_IF* and S_IRUSR/S_IWUSR */
  30076.              time_t   st_mtime;     /* time that the file was last written */
  30077.              nlink_t  st_nlink;     /* 2 + number of subdirs, or 1 for files */
  30078.              off_t    st_size;      /* size of file in bytes */
  30079.              off_t    st_blksize;   /* the size of transfer buffer */
  30080.              uid_t    st_uid;       /* what getuid() returns */
  30081.      };
  30082.  
  30083. The `st_atime', `st_ctime' and `st_mtime' have different values only
  30084. when long file names are supported (e.g. on Windows 9X); otherwise,
  30085. they all have the same value: the time that the file was last
  30086. written(1).  Most Windows 9X VFAT filesystems only support the date of
  30087. the file's last access (the time is set to zero); therefore, the DJGPP
  30088. implementation of `stat' sets the `st_atime' member to the same value
  30089. as `st_mtime' if the time part of `st_atime' returned by the filesystem
  30090. is zero (to prevent the situation where the file appears to have been
  30091. created *after* it was last accessed, which doesn't look good).
  30092.  
  30093. Some members of `struct stat' are very expensive to compute.  If your
  30094. application is a heavy user of `stat' and is too slow, you can disable
  30095. computation of the members your application doesn't need, as described
  30096. in *Note _djstat_flags::.
  30097.  
  30098. Return Value
  30099. ------------
  30100.  
  30101. Zero on success, nonzero on failure (and ERRNO set).
  30102.  
  30103. Portability
  30104. -----------
  30105.  
  30106. not ANSI, POSIX
  30107.  
  30108. Example
  30109. -------
  30110.  
  30111.      struct stat s;
  30112.      stat("data.txt", &s);
  30113.      if (S_ISDIR(s.st_mode))
  30114.        printf("is directory\n");
  30115.  
  30116. Implementation Notes
  30117. --------------------
  30118.  
  30119. Supplying a 100% Unix-compatible `stat' function under DOS is an
  30120. implementation nightmare.  The following notes describe some of the
  30121. obscure points specific to `stat's behavior in DJGPP.
  30122.  
  30123. 1. The `drive' for character devices (like `con', `/dev/null' and
  30124. others is returned as -1.  For drives networked by Novell Netware, it
  30125. is returned as -2.
  30126.  
  30127. 2. The starting cluster number of a file serves as its inode number.
  30128. For files whose starting cluster number is inaccessible (empty files,
  30129. files on Windows 9X, on networked drives, etc.) the `st_inode' field
  30130. will be *invented* in a way which guarantees that no two different
  30131. files will get the same inode number (thus it is unique).  This
  30132. invented inode will also be different from any real cluster number of
  30133. any local file.  However, only on plain DOS, and only for local,
  30134. non-empty files/directories the inode is guaranteed to be consistent
  30135. between `stat' and `fstat' function calls.
  30136.  
  30137. 3. The WRITE access mode bit is set only for the user (unless the file
  30138. is read-only, hidden or system).  EXECUTE bit is set for directories,
  30139. files which can be executed from the DOS prompt (batch files, .com,
  30140. .dll and .exe executables) or run by `go32-v2'.
  30141.  
  30142. 4. Size of directories is reported as the number of its files (sans `.'
  30143. and `..' entries) multiplied by 32 bytes (the size of directory entry).
  30144. On FAT filesystems that support the LFN API (such as Windows 9X), the
  30145. reported size of the directory accounts for additional space used to
  30146. store the long file names.
  30147.  
  30148. 5. Time stamp for root directories is taken from the volume label entry,
  30149. if that's available; otherwise, it is reported as 1-Jan-1980.
  30150.  
  30151. 6. The variable `_djstat_flags' (*note _djstat_flags::.) controls what
  30152. hard-to-get fields of `struct stat' are needed by the application.
  30153.  
  30154. 7. `stat' should not be used to get an up-to-date info about a file
  30155. which is open and has been written to, because `stat' will only return
  30156. correct data after the file is closed.  Use `fstat' (*note fstat::.)
  30157. while the file is open.  Alternatively, you can call `fflush' and
  30158. `fsync' to make the OS flush all the file's data to the disk, before
  30159. calling `stat'.
  30160.  
  30161. 8. The number of links `st_nlink' is always 1 for files other than
  30162. directories.  For directories, it is the number of subdirectories plus
  30163. 2.  This is so that programs written for Unix that depend on this to
  30164. optimize recursive traversal of the directory tree, will still work.
  30165.  
  30166. ---------- Footnotes ----------
  30167.  
  30168. (1) Even when long file names *are* supported, the three time values
  30169. returned by `stat' might be identical if the file was last written by a
  30170. program which used legacy DOS functions that don't know about long file
  30171. names.
  30172.  
  30173. 
  30174. File: libc.info,  Node: statfs,  Next: _status87,  Prev: stat,  Up: Alphabetical List
  30175.  
  30176. statfs
  30177. ======
  30178.  
  30179. Syntax
  30180. ------
  30181.  
  30182.      #include <sys/vfs.h>
  30183.      
  30184.      int statfs(const char *filename, struct statfs *buf);
  30185.  
  30186. Description
  30187. -----------
  30188.  
  30189. This function returns information about the given "filesystem".  The
  30190. drive letter of the given FILENAME, or the default drive if none is
  30191. given, is used to retrieve the following structure:
  30192.  
  30193.      struct statfs
  30194.      {
  30195.          long    f_type;   /* 0 */
  30196.          long    f_bsize;  /* bytes per cluster */
  30197.          long    f_blocks; /* clusters on drive */
  30198.          long    f_bfree;  /* available clusters */
  30199.          long    f_bavail; /* available clusters */
  30200.          long    f_files;  /* clusters on drive */
  30201.          long    f_ffree;  /* available clusters */
  30202.          fsid_t    f_fsid;   /* [0]=drive_number, [1]=MOUNT_UFS
  30203.          long    f_magic;  /* FS_MAGIC */
  30204.      };
  30205.  
  30206. Return Value
  30207. ------------
  30208.  
  30209. Zero on success, nonzero on failure.
  30210.  
  30211. Portability
  30212. -----------
  30213.  
  30214. not ANSI, not POSIX
  30215.  
  30216. Example
  30217. -------
  30218.  
  30219.      struct statfs fs;
  30220.      statfs("anything", &fs);
  30221.      printf("%d bytes left\n", fs.f_bfree * fs.f_bsize);
  30222.  
  30223. 
  30224. File: libc.info,  Node: _status87,  Next: _stklen,  Prev: statfs,  Up: Alphabetical List
  30225.  
  30226. _status87
  30227. =========
  30228.  
  30229. Syntax
  30230. ------
  30231.  
  30232.      #include <float.h>
  30233.      
  30234.      unsigned int _status87(void);
  30235.  
  30236. Description
  30237. -----------
  30238.  
  30239. Returns the status word of the FPU, which indicate the results of the
  30240. most recently completed FPU operation:
  30241.  
  30242.      ---- ---- ---- ---X = SW_INVALID - invalid operation
  30243.      ---- ---- ---- --X- = SW_DENORMAL - denormalized operand
  30244.      ---- ---- ---- -X-- = SW_ZERODIVIDE - division by zero
  30245.      ---- ---- ---- X--- = SW_OVERFLOW - overflow
  30246.      ---- ---- ---X ---- = SW_UNDERFLOW - underflow
  30247.      ---- ---- --X- ---- = SW_INEXACT - loss of precision
  30248.      ---- ---- -X-- ---- = SW_STACKFAULT - stack over/under flow
  30249.      ---- ---- X--- ---- = SW_ERRORSUMMARY - set if any errors
  30250.      -X-- -XXX ---- ---- = SW_COND - condition code
  30251.      ---- ---X ---- ---- = SW_C0
  30252.      ---- --X- ---- ---- = SW_C1
  30253.      ---- -X-- ---- ---- = SW_C2
  30254.      -X-- ---- ---- ---- = SW_C3
  30255.      --XX X--- ---- ---- = SW_TOP - top of stack (use SW_TOP_SHIFT to shift it)
  30256.      X--- ---- ---- ---- = SW_BUSY - fpu is busy
  30257.  
  30258. Portability
  30259. -----------
  30260.  
  30261. not ANSI, not POSIX
  30262.  
  30263. 
  30264. File: libc.info,  Node: _stklen,  Next: stpcpy,  Prev: _status87,  Up: Alphabetical List
  30265.  
  30266. _stklen
  30267. =======
  30268.  
  30269. Syntax
  30270. ------
  30271.  
  30272.      extern int _stklen;
  30273.  
  30274. Description
  30275. -----------
  30276.  
  30277. This variable sets the minimum stack length that the program requires.
  30278. Note that the stack may be much larger than this.  This value should be
  30279. set statically, as it is only used at startup.
  30280.  
  30281. Portability
  30282. -----------
  30283.  
  30284. not ANSI, not POSIX
  30285.  
  30286. Example
  30287. -------
  30288.  
  30289.      int _stklen = 256000;
  30290.  
  30291. 
  30292. File: libc.info,  Node: stpcpy,  Next: strcasecmp,  Prev: _stklen,  Up: Alphabetical List
  30293.  
  30294. stpcpy
  30295. ======
  30296.  
  30297. Syntax
  30298. ------
  30299.  
  30300.      #include <string.h>
  30301.      
  30302.      char *stpcpy(char *_dest, const char *_src);
  30303.  
  30304. Description
  30305. -----------
  30306.  
  30307. Like `strcpy' (*note strcpy::.), but return value different.
  30308.  
  30309. Return Value
  30310. ------------
  30311.  
  30312. Returns a pointer to the trailing NUL in DEST.
  30313.  
  30314. Portability
  30315. -----------
  30316.  
  30317. not ANSI, not POSIX
  30318.  
  30319. 
  30320. File: libc.info,  Node: strcasecmp,  Next: strcat,  Prev: stpcpy,  Up: Alphabetical List
  30321.  
  30322. strcasecmp
  30323. ==========
  30324.  
  30325. Syntax
  30326. ------
  30327.  
  30328.      #include <string.h>
  30329.      
  30330.      int strcasecmp(const char *s1, const char *s2);
  30331.  
  30332. Description
  30333. -----------
  30334.  
  30335. This function compares the two strings, disregarding case.
  30336.  
  30337. Return Value
  30338. ------------
  30339.  
  30340. Zero if they're the same, nonzero if different, the sign indicates
  30341. "order".
  30342.  
  30343. Portability
  30344. -----------
  30345.  
  30346. not ANSI, not POSIX
  30347.  
  30348. Example
  30349. -------
  30350.  
  30351.      if (strcasecmp(arg, "-i") == 0)
  30352.        do_include();
  30353.  
  30354. 
  30355. File: libc.info,  Node: strcat,  Next: strchr,  Prev: strcasecmp,  Up: Alphabetical List
  30356.  
  30357. strcat
  30358. ======
  30359.  
  30360. Syntax
  30361. ------
  30362.  
  30363.      #include <string.h>
  30364.      
  30365.      char *strcat(char *s1, const char *s2);
  30366.  
  30367. Description
  30368. -----------
  30369.  
  30370. This function concatenates S2 to the end of S1.
  30371.  
  30372. Return Value
  30373. ------------
  30374.  
  30375. S1
  30376.  
  30377. Portability
  30378. -----------
  30379.  
  30380. ANSI, POSIX
  30381.  
  30382. Example
  30383. -------
  30384.  
  30385.      char buf[100] = "hello";
  30386.      strcat(buf, " there");
  30387.  
  30388. 
  30389. File: libc.info,  Node: strchr,  Next: strcmp,  Prev: strcat,  Up: Alphabetical List
  30390.  
  30391. strchr
  30392. ======
  30393.  
  30394. Syntax
  30395. ------
  30396.  
  30397.      #include <string.h>
  30398.      
  30399.      char *strchr(const char *s, int c);
  30400.  
  30401. Description
  30402. -----------
  30403.  
  30404. This function returns a pointer to the first occurrence of C in S.
  30405. Note that if C is `NULL', this will return a pointer to the end of the
  30406. string.
  30407.  
  30408. Return Value
  30409. ------------
  30410.  
  30411. A pointer to the character, or `NULL' if it wasn't found.
  30412.  
  30413. Portability
  30414. -----------
  30415.  
  30416. ANSI, POSIX
  30417.  
  30418. Example
  30419. -------
  30420.  
  30421.      char *slash = strchr(filename, '/');
  30422.  
  30423. 
  30424. File: libc.info,  Node: strcmp,  Next: strcoll,  Prev: strchr,  Up: Alphabetical List
  30425.  
  30426. strcmp
  30427. ======
  30428.  
  30429. Syntax
  30430. ------
  30431.  
  30432.      #include <string.h>
  30433.      
  30434.      int strcmp(const char *s1, const char *s2);
  30435.  
  30436. Description
  30437. -----------
  30438.  
  30439. This function compares S1 and S2.
  30440.  
  30441. Return Value
  30442. ------------
  30443.  
  30444. Zero if the strings are equal, a positive number if S1 comes after S2
  30445. in the ASCII collating sequense, else a negative number.
  30446.  
  30447. Portability
  30448. -----------
  30449.  
  30450. ANSI, POSIX
  30451.  
  30452. Example
  30453. -------
  30454.  
  30455.      if (strcmp(arg, "-i") == 0)
  30456.        do_include();
  30457.  
  30458. 
  30459. File: libc.info,  Node: strcoll,  Next: strcpy,  Prev: strcmp,  Up: Alphabetical List
  30460.  
  30461. strcoll
  30462. =======
  30463.  
  30464. Syntax
  30465. ------
  30466.  
  30467.      #include <string.h>
  30468.      
  30469.      int strcoll(const char *s1, const char *s2);
  30470.  
  30471. Description
  30472. -----------
  30473.  
  30474. This function compares S1 and S2, using the collating sequences from
  30475. the current locale.
  30476.  
  30477. Return Value
  30478. ------------
  30479.  
  30480. Zero if the strings are equal, a positive number if S1 comes after S2
  30481. in the collating sequense, else a negative number.
  30482.  
  30483. Portability
  30484. -----------
  30485.  
  30486. ANSI, POSIX
  30487.  
  30488. Example
  30489. -------
  30490.  
  30491.      while (strcoll(var, list[i]) < 0)
  30492.        i++;
  30493.  
  30494. 
  30495. File: libc.info,  Node: strcpy,  Next: strcspn,  Prev: strcoll,  Up: Alphabetical List
  30496.  
  30497. strcpy
  30498. ======
  30499.  
  30500. Syntax
  30501. ------
  30502.  
  30503.      #include <string.h>
  30504.      
  30505.      char *strcpy(char *s1, const char *s2);
  30506.  
  30507. Description
  30508. -----------
  30509.  
  30510. This function copies S2 into S1.
  30511.  
  30512. Return Value
  30513. ------------
  30514.  
  30515. S1
  30516.  
  30517. Portability
  30518. -----------
  30519.  
  30520. ANSI, POSIX
  30521.  
  30522. Example
  30523. -------
  30524.  
  30525.      char buf[100];
  30526.      strcpy(buf, arg);
  30527.  
  30528. 
  30529. File: libc.info,  Node: strcspn,  Next: strdup,  Prev: strcpy,  Up: Alphabetical List
  30530.  
  30531. strcspn
  30532. =======
  30533.  
  30534. Syntax
  30535. ------
  30536.  
  30537.      #include <string.h>
  30538.      
  30539.      size_t strcspn(const char *s1, const char *set);
  30540.  
  30541. Description
  30542. -----------
  30543.  
  30544. This function finds the first character in S1 that matches any
  30545. character in SET.  Note that the `NULL' bytes at the end of each string
  30546. counts, so you'll at least get a pointer to the end of the string if
  30547. nothing else.
  30548.  
  30549. Return Value
  30550. ------------
  30551.  
  30552. The index of the found character.
  30553.  
  30554. Portability
  30555. -----------
  30556.  
  30557. ANSI, POSIX
  30558.  
  30559. Example
  30560. -------
  30561.  
  30562.      int i = strcspn(command, "<>|");
  30563.      if (command[i])
  30564.        do_redirection();
  30565.  
  30566. 
  30567. File: libc.info,  Node: strdup,  Next: strerror,  Prev: strcspn,  Up: Alphabetical List
  30568.  
  30569. strdup
  30570. ======
  30571.  
  30572. Syntax
  30573. ------
  30574.  
  30575.      #include <string.h>
  30576.      
  30577.      char * strdup (const char *source);
  30578.  
  30579. Description
  30580. -----------
  30581.  
  30582. Returns a newly allocated area of memory that contains a duplicate of
  30583. the string pointed to by SOURCE.  The memory returned by this call must
  30584. be freed by the caller.
  30585.  
  30586. Return Value
  30587. ------------
  30588.  
  30589. Returns the newly allocated string, or NULL if there is no more memory.
  30590.  
  30591. Portability
  30592. -----------
  30593.  
  30594. not ANSI, not POSIX
  30595.  
  30596. Example
  30597. -------
  30598.  
  30599.      char *foo()
  30600.      {
  30601.        return strdup("hello");
  30602.      }
  30603.  
  30604. 
  30605. File: libc.info,  Node: strerror,  Next: strftime,  Prev: strdup,  Up: Alphabetical List
  30606.  
  30607. strerror
  30608. ========
  30609.  
  30610. Syntax
  30611. ------
  30612.  
  30613.      #include <string.h>
  30614.      
  30615.      char *strerror(int error);
  30616.  
  30617. Description
  30618. -----------
  30619.  
  30620. This function returns a string that describes the ERROR.
  30621.  
  30622. Return Value
  30623. ------------
  30624.  
  30625. A pointer to a static string that should not be modified or free'd.
  30626.  
  30627. Portability
  30628. -----------
  30629.  
  30630. ANSI, POSIX
  30631.  
  30632. Example
  30633. -------
  30634.  
  30635.      if (f=fopen("foo", "r") == 0)
  30636.        printf("Error! %s: %s\n", "foo", strerror(errno));
  30637.  
  30638. 
  30639. File: libc.info,  Node: strftime,  Next: stricmp,  Prev: strerror,  Up: Alphabetical List
  30640.  
  30641. strftime
  30642. ========
  30643.  
  30644. Syntax
  30645. ------
  30646.  
  30647.      #include <time.h>
  30648.      
  30649.      size_t strftime(char *buf, size_t n, const char *format,
  30650.                      const struct tm *time_info);
  30651.  
  30652. Description
  30653. -----------
  30654.  
  30655. This function formats the time data in TIME_INFO according to the given
  30656. FORMAT and stores it in BUF, not exceeding N bytes.
  30657.  
  30658. The format string is like `printf' in that any character other than `%'
  30659. is added to the output string, and for each character following a `%' a
  30660. pattern is added to the string as follows, with the examples as if the
  30661. time was Friday, October 1, 1993, at 03:30:34 PM EDT:
  30662.  
  30663. `%A'
  30664.      The full weekday name (`Friday')
  30665.  
  30666. `%a'
  30667.      The abbreviated weekday name (`Fri')
  30668.  
  30669. `%B'
  30670.      The full month name (`October')
  30671.  
  30672. `%b'
  30673. `%h'
  30674.      The abbreviated month name (`Oct')
  30675.  
  30676. `%C'
  30677.      Short for `%a %b %e %H:%M:%S %Y' (`Fri Oct  1 15:30:34 1993')
  30678.  
  30679. `%c'
  30680.      Short for `%m/%d/%y %H:%M:%S' (`10/01/93 15:30:34')
  30681.  
  30682. `%e'
  30683.      The day of the month, blank padded to two characters (` 2')
  30684.  
  30685. `%D'
  30686.      Short for `%m/%d/%y' (`10/01/93')
  30687.  
  30688. `%d'
  30689.      The day of the month, zero padded to two characters (`02')
  30690.  
  30691. `%H'
  30692.      The hour (0-24), zero padded to two characters (`15')
  30693.  
  30694. `%I'
  30695.      The hour (1-12), zero padded to two characters (`03')
  30696.  
  30697. `%j'
  30698.      The Julian day, zero padded to three characters (`275')
  30699.  
  30700. `%k'
  30701.      The hour (0-24), space padded to two characters (`15')
  30702.  
  30703. `%l'
  30704.      The hour (1-12), space padded to two characters(` 3')
  30705.  
  30706. `%M'
  30707.      The minutes, zero padded to two characters (`30')
  30708.  
  30709. `%m'
  30710.      The month (1-12), zero padded to two characters (`10')
  30711.  
  30712. `%n'
  30713.      A newline (`\n')
  30714.  
  30715. `%p'
  30716.      AM or PM (`PM')
  30717.  
  30718. `%R'
  30719.      Short for `%H:%M' (`15:30')
  30720.  
  30721. `%r'
  30722.      Short for `%I:%M:%S %p' (`03:30:35 PM')
  30723.  
  30724. `%S'
  30725.      The seconds, zero padded to two characters (`35')
  30726.  
  30727. `%T'
  30728. `%X'
  30729.      Short for `%H:%M:%S' (`15:30:35')
  30730.  
  30731. `%t'
  30732.      A tab (`\t')
  30733.  
  30734. `%U'
  30735.      The week of the year, with the first week defined by the first
  30736.      Sunday of the year, zero padded to two characters (`39')
  30737.  
  30738. `%u'
  30739.      The day of the week (1-7) (`6')
  30740.  
  30741. `%W'
  30742.      The week of the year, with the first week defined by the first
  30743.      Monday of the year, zero padded to two characters (`39')
  30744.  
  30745. `%w'
  30746.      The day of the week (0-6) (`5')
  30747.  
  30748. `%x'
  30749.      Short for `%m/%d/%y' (`10/01/93')
  30750.  
  30751. `%y'
  30752.      The year (00-99) of the century (`93')
  30753.  
  30754. `%Y'
  30755.      The year, zero padded to four digits (`1993')
  30756.  
  30757. `%Z'
  30758.      The timezone abbreviation (`EDT')
  30759.  
  30760. `%%'
  30761.      A percent symbol (`%')
  30762.  
  30763. Return Value
  30764. ------------
  30765.  
  30766. The number of characters stored.
  30767.  
  30768. Portability
  30769. -----------
  30770.  
  30771. ANSI, POSIX
  30772.  
  30773. Example
  30774. -------
  30775.  
  30776.      time_t now = time (NULL);
  30777.      struct tm *t = localtime (&now);
  30778.      char buf[100];
  30779.      /* Print today's date e.g. "January 31, 2001".  */
  30780.      strftime (buf, 100, "%B %d, %Y", t);
  30781.  
  30782. 
  30783. File: libc.info,  Node: stricmp,  Next: strlen,  Prev: strftime,  Up: Alphabetical List
  30784.  
  30785. stricmp
  30786. =======
  30787.  
  30788. Syntax
  30789. ------
  30790.  
  30791.      #include <string.h>
  30792.      
  30793.      int stricmp(const char *s1, const char *s2);
  30794.  
  30795. Description
  30796. -----------
  30797.  
  30798. This function compares the two strings, disregarding case.
  30799.  
  30800. Return Value
  30801. ------------
  30802.  
  30803. Zero if they're the same, nonzero if different, the sign indicates
  30804. "order".
  30805.  
  30806. Portability
  30807. -----------
  30808.  
  30809. not ANSI, not POSIX
  30810.  
  30811. Example
  30812. -------
  30813.  
  30814.      if (stricmp(arg, "-i") == 0)
  30815.        do_include();
  30816.  
  30817. 
  30818. File: libc.info,  Node: strlen,  Next: strlwr,  Prev: stricmp,  Up: Alphabetical List
  30819.  
  30820. strlen
  30821. ======
  30822.  
  30823. Syntax
  30824. ------
  30825.  
  30826.      #include <string.h>
  30827.      
  30828.      size_t strlen(const char *string);
  30829.  
  30830. Description
  30831. -----------
  30832.  
  30833. This function returns the number of characters in STRING.
  30834.  
  30835. Return Value
  30836. ------------
  30837.  
  30838. The length of the string.
  30839.  
  30840. Portability
  30841. -----------
  30842.  
  30843. ANSI, POSIX
  30844.  
  30845. Example
  30846. -------
  30847.  
  30848.      if (strlen(fname) > PATH_MAX)
  30849.        invalid_file(fname);
  30850.  
  30851. 
  30852. File: libc.info,  Node: strlwr,  Next: strncasecmp,  Prev: strlen,  Up: Alphabetical List
  30853.  
  30854. strlwr
  30855. ======
  30856.  
  30857. Syntax
  30858. ------
  30859.  
  30860.      #include <string.h>
  30861.      
  30862.      char *strlwr(char *string);
  30863.  
  30864. Description
  30865. -----------
  30866.  
  30867. This function replaces all upper case letters in STRING with lower case
  30868. letters.
  30869.  
  30870. Return Value
  30871. ------------
  30872.  
  30873. The string.
  30874.  
  30875. Portability
  30876. -----------
  30877.  
  30878. not ANSI, not POSIX
  30879.  
  30880. Example
  30881. -------
  30882.  
  30883.      char buf[100] = "Hello";
  30884.      strlwr(buf);
  30885.  
  30886. 
  30887. File: libc.info,  Node: strncasecmp,  Next: strncat,  Prev: strlwr,  Up: Alphabetical List
  30888.  
  30889. strncasecmp
  30890. ===========
  30891.  
  30892. Syntax
  30893. ------
  30894.  
  30895.      #include <string.h>
  30896.      
  30897.      int strncasecmp(const char *s1, const char *s2, size_t max);
  30898.  
  30899. Description
  30900. -----------
  30901.  
  30902. This function compares S1 and S2, ignoring case, up to a maximum of MAX
  30903. characters.
  30904.  
  30905. Return Value
  30906. ------------
  30907.  
  30908. Zero if the strings are equal, a positive number if S1 comes after S2
  30909. in the ASCII collating sequense, else a negative number.
  30910.  
  30911. Portability
  30912. -----------
  30913.  
  30914. not ANSI, not POSIX
  30915.  
  30916. Example
  30917. -------
  30918.  
  30919.      if (strncasecmp(foo, "-i", 2) == 0)
  30920.        do_include();
  30921.  
  30922. 
  30923. File: libc.info,  Node: strncat,  Next: strncmp,  Prev: strncasecmp,  Up: Alphabetical List
  30924.  
  30925. strncat
  30926. =======
  30927.  
  30928. Syntax
  30929. ------
  30930.  
  30931.      #include <string.h>
  30932.      
  30933.      char *strncat(char *s1, const char *s2, size_t max);
  30934.  
  30935. Description
  30936. -----------
  30937.  
  30938. This function concatenates up to MAX characters of S2 to the end of S1.
  30939.  
  30940. Return Value
  30941. ------------
  30942.  
  30943. S1
  30944.  
  30945. Portability
  30946. -----------
  30947.  
  30948. ANSI, POSIX
  30949.  
  30950. Example
  30951. -------
  30952.  
  30953.      strncat(fname, extension, 4);
  30954.  
  30955. 
  30956. File: libc.info,  Node: strncmp,  Next: strncpy,  Prev: strncat,  Up: Alphabetical List
  30957.  
  30958. strncmp
  30959. =======
  30960.  
  30961. Syntax
  30962. ------
  30963.  
  30964.      #include <string.h>
  30965.      
  30966.      int strncmp(const char *s1, const char *s2, size_t max);
  30967.  
  30968. Description
  30969. -----------
  30970.  
  30971. This function compares up to MAX characters of S1 and S2.
  30972.  
  30973. Return Value
  30974. ------------
  30975.  
  30976. Zero if the strings are equal, a positive number if S1 comes after S2
  30977. in the ASCII collating sequense, else a negative number.
  30978.  
  30979. Portability
  30980. -----------
  30981.  
  30982. ANSI, POSIX
  30983.  
  30984. Example
  30985. -------
  30986.  
  30987.      if (strncmp(arg, "-i", 2) == 0)
  30988.        do_include();
  30989.  
  30990. 
  30991. File: libc.info,  Node: strncpy,  Next: strnicmp,  Prev: strncmp,  Up: Alphabetical List
  30992.  
  30993. strncpy
  30994. =======
  30995.  
  30996. Syntax
  30997. ------
  30998.  
  30999.      #include <string.h>
  31000.      
  31001.      char *strncpy(char *s1, const char *s2, size_t max);
  31002.  
  31003. Description
  31004. -----------
  31005.  
  31006. This function copies up to MAX characters of S2 into S1.
  31007.  
  31008. Return Value
  31009. ------------
  31010.  
  31011. S1
  31012.  
  31013. Portability
  31014. -----------
  31015.  
  31016. ANSI, POSIX
  31017.  
  31018. Example
  31019. -------
  31020.  
  31021.      char buf[100];
  31022.      strncpy(buf, arg, 99);
  31023.  
  31024. 
  31025. File: libc.info,  Node: strnicmp,  Next: strpbrk,  Prev: strncpy,  Up: Alphabetical List
  31026.  
  31027. strnicmp
  31028. ========
  31029.  
  31030. Syntax
  31031. ------
  31032.  
  31033.      #include <string.h>
  31034.      
  31035.      int strnicmp(const char *s1, const char *s2, size_t max);
  31036.  
  31037. Description
  31038. -----------
  31039.  
  31040. This function compares S1 and S2, ignoring case, up to a maximum of MAX
  31041. characters.
  31042.  
  31043. Return Value
  31044. ------------
  31045.  
  31046. Zero if the strings are equal, a positive number if S1 comes after S2
  31047. in the ASCII collating sequense, else a negative number.
  31048.  
  31049. Portability
  31050. -----------
  31051.  
  31052. not ANSI, not POSIX
  31053.  
  31054. Example
  31055. -------
  31056.  
  31057.      if (strnicmp(foo, "-i", 2) == 0)
  31058.        do_include();
  31059.  
  31060. 
  31061. File: libc.info,  Node: strpbrk,  Next: strrchr,  Prev: strnicmp,  Up: Alphabetical List
  31062.  
  31063. strpbrk
  31064. =======
  31065.  
  31066. Syntax
  31067. ------
  31068.  
  31069.      #include <string.h>
  31070.      
  31071.      char *strpbrk(const char *s1, const char *set);
  31072.  
  31073. Description
  31074. -----------
  31075.  
  31076. This function finds the first character in S1 that matches any
  31077. character in SET.
  31078.  
  31079. Return Value
  31080. ------------
  31081.  
  31082. A pointer to the first match, or `NULL' if none are found.
  31083.  
  31084. Portability
  31085. -----------
  31086.  
  31087. ANSI, POSIX
  31088.  
  31089. Example
  31090. -------
  31091.  
  31092.      if (strpbrk(command, "<>|"))
  31093.        do_redirection();
  31094.  
  31095. 
  31096. File: libc.info,  Node: strrchr,  Next: strsep,  Prev: strpbrk,  Up: Alphabetical List
  31097.  
  31098. strrchr
  31099. =======
  31100.  
  31101. Syntax
  31102. ------
  31103.  
  31104.      #include <string.h>
  31105.      
  31106.      char *strrchr(const char *s1, int c);
  31107.  
  31108. Description
  31109. -----------
  31110.  
  31111. This function finds the last occurrence of `c' in `s1'.
  31112.  
  31113. Return Value
  31114. ------------
  31115.  
  31116. A pointer to the last match, or `NULL' if the character isn't in the
  31117. string.
  31118.  
  31119. Portability
  31120. -----------
  31121.  
  31122. ANSI, POSIX
  31123.  
  31124. Example
  31125. -------
  31126.  
  31127.      char *last_slash = strrchr(filename, '/');
  31128.  
  31129. 
  31130. File: libc.info,  Node: strsep,  Next: strspn,  Prev: strrchr,  Up: Alphabetical List
  31131.  
  31132. strsep
  31133. ======
  31134.  
  31135. Syntax
  31136. ------
  31137.  
  31138.      #include <string.h>
  31139.      
  31140.      char *strsep(char **stringp, char *delim);
  31141.  
  31142. Description
  31143. -----------
  31144.  
  31145. This function retrieves the next token from the given string, where
  31146. STRINGP points to a variable holding, initially, the start of the
  31147. string.  Tokens are delimited by a character from DELIM.  Each time the
  31148. function is called, it returns a pointer to the next token, and sets
  31149. *STRINGP to the next spot to check, or `NULL'.
  31150.  
  31151. Return Value
  31152. ------------
  31153.  
  31154. The next token, or NULL.
  31155.  
  31156. Portability
  31157. -----------
  31158.  
  31159. not ANSI, not POSIX
  31160.  
  31161. Example
  31162. -------
  31163.  
  31164.      main()
  31165.      {
  31166.        char *buf = "Hello  there,stranger";
  31167.        char **bp = &buf;
  31168.        char *tok;
  31169.        while (tok = strsep(bp, " ,"))
  31170.          printf("tok = `%s'\n", tok);
  31171.      }
  31172.      
  31173.      tok = `Hello'
  31174.      tok = `'
  31175.      tok = `there'
  31176.      tok = `stranger'
  31177.  
  31178. 
  31179. File: libc.info,  Node: strspn,  Next: strstr,  Prev: strsep,  Up: Alphabetical List
  31180.  
  31181. strspn
  31182. ======
  31183.  
  31184. Syntax
  31185. ------
  31186.  
  31187.      #include <string.h>
  31188.      
  31189.      size_t strspn(const char *s1, const char *set);
  31190.  
  31191. Description
  31192. -----------
  31193.  
  31194. This function finds the first character in S1 that does not match any
  31195. character in SET.  Note that the `NULL' bytes at the end of S1 counts,
  31196. so you'll at least get a pointer to the end of the string if nothing
  31197. else.
  31198.  
  31199. Return Value
  31200. ------------
  31201.  
  31202. The index of the found character.
  31203.  
  31204. Portability
  31205. -----------
  31206.  
  31207. ANSI, POSIX
  31208.  
  31209. Example
  31210. -------
  31211.  
  31212.      int i = strspn(entry, " \t\b");
  31213.      if (entry[i])
  31214.        do_something();
  31215.  
  31216. 
  31217. File: libc.info,  Node: strstr,  Next: strtod,  Prev: strspn,  Up: Alphabetical List
  31218.  
  31219. strstr
  31220. ======
  31221.  
  31222. Syntax
  31223. ------
  31224.  
  31225.      #include <string.h>
  31226.      
  31227.      char *strstr(const char *s1, const char *s2);
  31228.  
  31229. Description
  31230. -----------
  31231.  
  31232. This function finds the first occurrence of S2 in S1.
  31233.  
  31234. Return Value
  31235. ------------
  31236.  
  31237. A pointer within S1, or `NULL' if S2 wasn't found.
  31238.  
  31239. Portability
  31240. -----------
  31241.  
  31242. ANSI, POSIX
  31243.  
  31244. Example
  31245. -------
  31246.  
  31247.      if (strstr(command, ".exe"))
  31248.        do_exe();
  31249.  
  31250. 
  31251. File: libc.info,  Node: strtod,  Next: strtok,  Prev: strstr,  Up: Alphabetical List
  31252.  
  31253. strtod
  31254. ======
  31255.  
  31256. Syntax
  31257. ------
  31258.  
  31259.      #include <stdlib.h>
  31260.      
  31261.      double strtod(const char *s, char **endp);
  31262.  
  31263. Description
  31264. -----------
  31265.  
  31266. This function converts as many characters of S as look like a floating
  31267. point number into that number.  If ENDP is not a null pointer, `*endp'
  31268. is set to point to the first unconverted character.
  31269.  
  31270. Return Value
  31271. ------------
  31272.  
  31273. The value the represented by S.
  31274.  
  31275. If a number represented by S doesn't fit into the range of values
  31276. representable by the type `double', the function returns either
  31277. `-HUGE_VAL' (if S begins with the character `-') or `+HUGE_VAL', and
  31278. sets `errno' to `ERANGE'.
  31279.  
  31280. Portability
  31281. -----------
  31282.  
  31283. ANSI, POSIX
  31284.  
  31285. Example
  31286. -------
  31287.  
  31288.      char *buf = "123ret";
  31289.      char *bp;
  31290.      double x = strtod(buf, &bp);
  31291.  
  31292. 
  31293. File: libc.info,  Node: strtok,  Next: strtol,  Prev: strtod,  Up: Alphabetical List
  31294.  
  31295. strtok
  31296. ======
  31297.  
  31298. Syntax
  31299. ------
  31300.  
  31301.      #include <string.h>
  31302.      
  31303.      char *strtok(char *s1, const char *s2);
  31304.  
  31305. Description
  31306. -----------
  31307.  
  31308. This function retrieves tokens from S1 which are delimited by
  31309. characters from S2.
  31310.  
  31311. To initiate the search, pass the string to be searched as S1.  For the
  31312. remaining tokens, pass `NULL' instead.
  31313.  
  31314. Return Value
  31315. ------------
  31316.  
  31317. A pointer to the token, or `NULL' if no more are found.
  31318.  
  31319. Portability
  31320. -----------
  31321.  
  31322. ANSI, POSIX
  31323.  
  31324. Example
  31325. -------
  31326.  
  31327.      main()
  31328.      {
  31329.        char *buf = "Hello there, stranger";
  31330.        char *tok;
  31331.        for (tok = strtok(buf, " ,");
  31332.             tok;
  31333.             tok=strtok(0, " ,"))
  31334.          printf("tok = `%s'\n", tok);
  31335.      }
  31336.      
  31337.      tok = `Hello'
  31338.      tok = `there'
  31339.      tok = `stranger'
  31340.  
  31341. 
  31342. File: libc.info,  Node: strtol,  Next: _strtold,  Prev: strtok,  Up: Alphabetical List
  31343.  
  31344. strtol
  31345. ======
  31346.  
  31347. Syntax
  31348. ------
  31349.  
  31350.      #include <stdlib.h>
  31351.      
  31352.      long strtol(const char *s, char **endp, int base);
  31353.  
  31354. Description
  31355. -----------
  31356.  
  31357. This function converts as much of S as looks like an appropriate number
  31358. into the value of that number.  If ENDP is not a null pointer, *ENDP is
  31359. set to point to the first unused character.
  31360.  
  31361. The BASE argument indicates what base the digits (or letters) should be
  31362. treated as.  If BASE is zero, the base is determined by looking for
  31363. `0x', `0X', or `0' as the first part of the string, and sets the base
  31364. used to 16, 16, or 8 if it finds one.  The default base is 10 if none
  31365. of those prefixes are found.
  31366.  
  31367. Return Value
  31368. ------------
  31369.  
  31370. The value.
  31371.  
  31372. Portability
  31373. -----------
  31374.  
  31375. ANSI, POSIX
  31376.  
  31377. Example
  31378. -------
  31379.  
  31380.      printf("Enter a number: "); fflush(stdout);
  31381.      gets(buf);
  31382.      char *bp;
  31383.      printf("The value is %d\n", strtol(buf, &bp, 0));
  31384.  
  31385. 
  31386. File: libc.info,  Node: _strtold,  Next: strtoll,  Prev: strtol,  Up: Alphabetical List
  31387.  
  31388. _strtold
  31389. ========
  31390.  
  31391. Syntax
  31392. ------
  31393.  
  31394.      #include <stdlib.h>
  31395.      
  31396.      long double _strtold(const char *s, char **endp);
  31397.  
  31398. Description
  31399. -----------
  31400.  
  31401. This function converts as many characters of S that look like a
  31402. floating point number into one, and sets *ENDP to point to the first
  31403. unused character.
  31404.  
  31405. Return Value
  31406. ------------
  31407.  
  31408. The value the string represented.
  31409.  
  31410. Portability
  31411. -----------
  31412.  
  31413. not ANSI, not POSIX
  31414.  
  31415. Example
  31416. -------
  31417.  
  31418.      char *buf = "123ret";
  31419.      char *bp;
  31420.      long double x = _strtold(buf, &bp);
  31421.  
  31422. 
  31423. File: libc.info,  Node: strtoll,  Next: strtoul,  Prev: _strtold,  Up: Alphabetical List
  31424.  
  31425. strtoll
  31426. =======
  31427.  
  31428. Syntax
  31429. ------
  31430.  
  31431.      #include <stdlib.h>
  31432.      
  31433.      long long strtoll(const char *s, char **endp, int base);
  31434.  
  31435. Description
  31436. -----------
  31437.  
  31438. This function converts as much of S as looks like an appropriate number
  31439. into the value of that number, and sets *ENDP to point to the first
  31440. unused character.
  31441.  
  31442. The BASE argument indicates what base the digits (or letters) should be
  31443. treated as.  If BASE is zero, the base is determined by looking for
  31444. `0x', `0X', or `0' as the first part of the string, and sets the base
  31445. used to 16, 16, or 8 if it finds one.  The default base is 10 if none
  31446. of those prefixes are found.
  31447.  
  31448. Return Value
  31449. ------------
  31450.  
  31451. The value.
  31452.  
  31453. Portability
  31454. -----------
  31455.  
  31456. not ANSI, not POSIX
  31457.  
  31458. Example
  31459. -------
  31460.  
  31461.      printf("Enter a number: "); fflush(stdout);
  31462.      gets(buf);
  31463.      char *bp;
  31464.      printf("The value is %lld\n", strtoll(buf, &bp, 0));
  31465.  
  31466. 
  31467. File: libc.info,  Node: strtoul,  Next: strtoull,  Prev: strtoll,  Up: Alphabetical List
  31468.  
  31469. strtoul
  31470. =======
  31471.  
  31472. Syntax
  31473. ------
  31474.  
  31475.      #include <stdlib.h>
  31476.      
  31477.      unsigned long strtoul(const char *s, char **endp, int base);
  31478.  
  31479. Description
  31480. -----------
  31481.  
  31482. This is just like `strtol' (*note strtol::.) except that the result is
  31483. unsigned.
  31484.  
  31485. Return Value
  31486. ------------
  31487.  
  31488. The value.
  31489.  
  31490. Portability
  31491. -----------
  31492.  
  31493. ANSI, POSIX
  31494.  
  31495. Example
  31496. -------
  31497.  
  31498.      printf("Enter a number: "); fflush(stdout);
  31499.      gets(buf);
  31500.      char *bp;
  31501.      printf("The value is %u\n", strtoul(buf, &bp, 0));
  31502.  
  31503. 
  31504. File: libc.info,  Node: strtoull,  Next: strupr,  Prev: strtoul,  Up: Alphabetical List
  31505.  
  31506. strtoull
  31507. ========
  31508.  
  31509. Syntax
  31510. ------
  31511.  
  31512.      #include <stdlib.h>
  31513.      
  31514.      unsigned long long strtoull(const char *s, char **endp, int base);
  31515.  
  31516. Description
  31517. -----------
  31518.  
  31519. This is just like `strtoll' (*note strtoll::.) except that the result
  31520. is unsigned.
  31521.  
  31522. Return Value
  31523. ------------
  31524.  
  31525. The value.
  31526.  
  31527. Portability
  31528. -----------
  31529.  
  31530. not ANSI, not POSIX
  31531.  
  31532. Example
  31533. -------
  31534.  
  31535.      printf("Enter a number: "); fflush(stdout);
  31536.      gets(buf);
  31537.      char *bp;
  31538.      printf("The value is %llu\n", strtoull(buf, &bp, 0));
  31539.  
  31540. 
  31541. File: libc.info,  Node: strupr,  Next: strxfrm,  Prev: strtoull,  Up: Alphabetical List
  31542.  
  31543. strupr
  31544. ======
  31545.  
  31546. Syntax
  31547. ------
  31548.  
  31549.      #include <string.h>
  31550.      
  31551.      char *strupr(char *string);
  31552.  
  31553. Description
  31554. -----------
  31555.  
  31556. This function converts all lower case characters in STRING to upper
  31557. case.
  31558.  
  31559. Return Value
  31560. ------------
  31561.  
  31562. STRING
  31563.  
  31564. Portability
  31565. -----------
  31566.  
  31567. not ANSI, not POSIX
  31568.  
  31569. Example
  31570. -------
  31571.  
  31572.      char buf[] = "Foo!";
  31573.      strupr(buf);
  31574.  
  31575. 
  31576. File: libc.info,  Node: strxfrm,  Next: swab,  Prev: strupr,  Up: Alphabetical List
  31577.  
  31578. strxfrm
  31579. =======
  31580.  
  31581. Syntax
  31582. ------
  31583.  
  31584.      #include <string.h>
  31585.      
  31586.      size_t strxfrm(char *s1, const char *s2, size_t max);
  31587.  
  31588. Description
  31589. -----------
  31590.  
  31591. This copies characters from S2 to S1, which must be able to hold MAX
  31592. characters.  Each character is transformed according to the locale such
  31593. that `strcmp(s1b, s2b)' is just like `strcoll(s1, s2)' where `s1b' and
  31594. `s2b' are the transforms of `s1' and `s2'.
  31595.  
  31596. Return Value
  31597. ------------
  31598.  
  31599. The actual number of bytes required to transform S2, including the
  31600. `NULL'.
  31601.  
  31602. Portability
  31603. -----------
  31604.  
  31605. ANSI, POSIX
  31606.  
  31607. 
  31608. File: libc.info,  Node: swab,  Next: symlink,  Prev: strxfrm,  Up: Alphabetical List
  31609.  
  31610. swab
  31611. ====
  31612.  
  31613. Syntax
  31614. ------
  31615.  
  31616.      #include <stdlib.h>
  31617.      
  31618.      void swab(const void *from, void *to, int nbytes);
  31619.  
  31620. Description
  31621. -----------
  31622.  
  31623. This function copies NBYTES bytes from the address pointed to by FROM
  31624. to the address pointed by TO, exchanging adjacent even and odd bytes.
  31625. It is useful for carrying binary data between little-endian and
  31626. big-endian machines.  The argument NBYTES should be even, and the
  31627. buffers FROM and TO should not overlap.
  31628.  
  31629. Return Value
  31630. ------------
  31631.  
  31632. None.
  31633.  
  31634. Portability
  31635. -----------
  31636.  
  31637. not ANSI, not POSIX
  31638.  
  31639. 
  31640. File: libc.info,  Node: symlink,  Next: syms_init,  Prev: swab,  Up: Alphabetical List
  31641.  
  31642. symlink
  31643. =======
  31644.  
  31645. Syntax
  31646. ------
  31647.  
  31648.      #include <unistd.h>
  31649.      
  31650.      int symlink(const char *exists, const char *new);
  31651.  
  31652. Description
  31653. -----------
  31654.  
  31655. MSDOS doesn't support symbolic links.  However, DJGPP supports
  31656. "symlinks" to DJGPP programs.  This function simulates a symlink
  31657. between two `.exe' files in the DJGPP style.  It creates a program
  31658. whose name is pointed to by NEW which, when run, will actually execute
  31659. the program EXISTS passing it the string pointed by NEW in `argv[0]'
  31660. (some programs change their behavior depending on what's passed in
  31661. `argv[0]').  The file referred to by EXISTS doesn't really have to
  31662. exist when this function is called.  If EXISTS points to an *existing*
  31663. file, the function checks that it is a DJGPP executable; if not, the
  31664. call will fail with `EXDEV'.
  31665.  
  31666. Both NEW and EXISTS can point to a name with or without the `.exe'
  31667. extension.
  31668.  
  31669. Note that both EXISTS and NEW must specify file names which reside in
  31670. the same directory (this is a restriction of the DJGPP "symlinks"); the
  31671. function will fail and set `errno' to `EXDEV' if they aren't.
  31672.  
  31673. This functions runs the `stubify' and `stubedit' programs, so they
  31674. should be somewhere on your `PATH' for the function to succeed.  (These
  31675. programs come with the DJGPP development distribution.)
  31676.  
  31677. Return Value
  31678. ------------
  31679.  
  31680. Zero in case of success, -1 in case of failure (and `errno' set to the
  31681. appropriate error code).
  31682.  
  31683. Portability
  31684. -----------
  31685.  
  31686. not ANSI, not POSIX
  31687.  
  31688. Example
  31689. -------
  31690.  
  31691.      symlink ("c:/djgpp/bin/grep", "c:/djgpp/bin/fgrep");
  31692.  
  31693. 
  31694. File: libc.info,  Node: syms_init,  Next: syms_line2val,  Prev: symlink,  Up: Alphabetical List
  31695.  
  31696. syms_init
  31697. =========
  31698.  
  31699. Syntax
  31700. ------
  31701.  
  31702.      #include <debug/syms.h>
  31703.      
  31704.      void syms_init (char *file);
  31705.  
  31706. Description
  31707. -----------
  31708.  
  31709. This function reads debugging symbols from the named FILE, which should
  31710. be an executable program (either a `.exe' file or a raw COFF image
  31711. created by `ld.exe', the linker).  It then processes the symbols:
  31712. classifies them by type, sorts them by name and value, and stores them
  31713. in internal data structures used by other symbol-related functions,
  31714. such as `syms_val2name', `syms_val2line', etc.
  31715.  
  31716. You *must* call `syms_init' before calling the other `syms_*' functions.
  31717.  
  31718. Currently, `syms_init' only supports COFF and AOUT debugging format, so
  31719. programs compiled with `-gstabs' cannot be processed by it.
  31720.  
  31721. Return Value
  31722. ------------
  31723.  
  31724. None.
  31725.  
  31726. not ANSI, not POSIX
  31727.  
  31728. Example
  31729. -------
  31730.  
  31731.        syms_init("c:/foo/bar/baz.exe");
  31732.  
  31733. 
  31734. File: libc.info,  Node: syms_line2val,  Next: syms_listwild,  Prev: syms_init,  Up: Alphabetical List
  31735.  
  31736. syms_line2val
  31737. =============
  31738.  
  31739. Syntax
  31740. ------
  31741.  
  31742.      #include <debug/syms.h>
  31743.      
  31744.      unsigned long syms_line2val (char *filename, int lnum);
  31745.  
  31746. Description
  31747. -----------
  31748.  
  31749. This function returns the address of the first instruction produced from
  31750. the line LNUM of the source file FILENAME that was linked into a
  31751. program whose symbols were read by a previous call to `syms_init'.
  31752.  
  31753. COFF debugging format does not support pathnames, so FILENAME should
  31754. not include leading directories, just the basename.
  31755.  
  31756. You must call `syms_init' (*note syms_init::.) before calling any of
  31757. the other `syms_*' functions for the first time.
  31758.  
  31759. Return Value
  31760. ------------
  31761.  
  31762. The address of the first instruction produced from the line, or zero if
  31763. FILENAME is not found in the symbol table or if no executable code was
  31764. generated for line LNUM in FILENAME.
  31765.  
  31766. Portability
  31767. -----------
  31768.  
  31769. not ANSI, not POSIX
  31770.  
  31771. Example
  31772. -------
  31773.  
  31774.       syms_init ("foo.exe");
  31775.       printf ("Line 3 of foo.c is at address %lx\n",
  31776.                syms_line2val("foo.c", 3));
  31777.  
  31778. 
  31779. File: libc.info,  Node: syms_listwild,  Next: syms_module,  Prev: syms_line2val,  Up: Alphabetical List
  31780.  
  31781. syms_listwild
  31782. =============
  31783.  
  31784. Syntax
  31785. ------
  31786.  
  31787.      #include <debug/syms.h>
  31788.      
  31789.      void syms_listwild (char *pattern,
  31790.                          void (*handler) (unsigned long addr, char type_c,
  31791.                                           char *name, char *file, int lnum));
  31792.  
  31793. Description
  31794. -----------
  31795.  
  31796. This function walks through all the symbols that were read by a previous
  31797. call to `syms_init' (*note syms_init::.).  For each symbol whose name
  31798. matches PATTERN, it invokes the user-defined function HANDLER, passing
  31799. it information about that symbol:
  31800.  
  31801. `address'
  31802.      the address of the symbol.
  31803.  
  31804. `type_c'
  31805.      a letter that specifies the type of the symbol, as follows:
  31806.  
  31807.     `T'
  31808.     `t'
  31809.           "text", or code: usually a function.
  31810.  
  31811.     `D'
  31812.     `d'
  31813.           data: an initialized variable.
  31814.  
  31815.     `B'
  31816.     `b'
  31817.           "bss": an uninitialized variable.
  31818.  
  31819.     `F'
  31820.  
  31821.     `f'
  31822.           a function (in `a.out' file only).
  31823.  
  31824.     `V'
  31825.     `v'
  31826.           a set element or pointer (in `a.out' file only).
  31827.  
  31828.     `I'
  31829.     `i'
  31830.           an indirect symbol (in `a.out' file only).
  31831.  
  31832.     `U'
  31833.     `u'
  31834.           an undefined (a.k.a. unresolved) symbol.
  31835.  
  31836.     `A'
  31837.     `a'
  31838.           an absolute symbol.
  31839.  
  31840. `name'
  31841.      the name of the symbol.
  31842.  
  31843. `file'
  31844.      the source file name where the symbol is defined.
  31845.  
  31846. `lnum'
  31847.      the line number on which the symbol is defined in the source file.
  31848.  
  31849. Since variables and functions defined in C get prepended with an
  31850. underscore `_', begin PATTERN with `_' if you want it to match C
  31851. symbols.
  31852.  
  31853. You must call `syms_init' (*note syms_init::.) before calling any of
  31854. the other `syms_*' functions for the first time.
  31855.  
  31856. Return Value
  31857. ------------
  31858.  
  31859. None.
  31860.  
  31861. Portability
  31862. -----------
  31863.  
  31864. not ANSI, not POSIX
  31865.  
  31866. Example
  31867. -------
  31868.  
  31869.        void print_sym (unsigned long addr, char type_c,
  31870.                        char *name, char *file, int lnum)
  31871.        {
  31872.          printf (file ? "%s: %lx %c %s:%d\n" : "%s: %lx %c\n",
  31873.                  name, addr, type_c,
  31874.                  file ? file : "", lnum );
  31875.        }
  31876.      
  31877.        int main (void)
  31878.        {
  31879.          syms_init ("foo.exe");
  31880.          /* List all the symbols which begin with "___djgpp".  */
  31881.          syms_listwild ("___djgpp*", print_sym);
  31882.          return 0;
  31883.        }
  31884.  
  31885. 
  31886. File: libc.info,  Node: syms_module,  Next: syms_name2val,  Prev: syms_listwild,  Up: Alphabetical List
  31887.  
  31888. syms_module
  31889. ===========
  31890.  
  31891. Syntax
  31892. ------
  31893.  
  31894.      #include <debug/syms.h>
  31895.      
  31896.      char *syms_module (int nfile);
  31897.  
  31898. Description
  31899. -----------
  31900.  
  31901. This function returns the name of the source file (a.k.a. module) whose
  31902. ordinal number in the symbol table is NFILE.
  31903.  
  31904. You must call `syms_init' (*note syms_init::.) before calling any of
  31905. the other `syms_*' functions for the first time.
  31906.  
  31907. Return Value
  31908. ------------
  31909.  
  31910. The name of the source file, or a `NULL' pointer if NFILE is negative
  31911. or larger than the total number of modules linked into the program
  31912. whose symbols were read by `syms_init'.
  31913.  
  31914. Portability
  31915. -----------
  31916.  
  31917. not ANSI, not POSIX
  31918.  
  31919. 
  31920. File: libc.info,  Node: syms_name2val,  Next: syms_val2line,  Prev: syms_module,  Up: Alphabetical List
  31921.  
  31922. syms_name2val
  31923. =============
  31924.  
  31925. Syntax
  31926. ------
  31927.  
  31928.      #include <debug/syms.h>
  31929.      extern int undefined_symbol;
  31930.      extern int syms_printwhy;
  31931.      
  31932.      unsigned long syms_name2val (const char *string);
  31933.  
  31934. Description
  31935. -----------
  31936.  
  31937. This function returns the address of a symbol specified by STRING.
  31938. STRING may be one of the following:
  31939.  
  31940.    * A number, with or without a sign, in which case the number
  31941.      specifies the address or an offset from an address.
  31942.  
  31943.    * A file name and a line number: `FILE#[LINE]', where FILE is the
  31944.      name of one of the source files linked into the program whose
  31945.      symbols were read by `syms_init', and LINE is a line number in
  31946.      that FILE.  If LINE is omitted, it defaults to zero.
  31947.  
  31948.      Note that the COFF format supported by DJGPP only stores the
  31949.      basename of the source files, so do not specify FILE with leading
  31950.      directories.
  31951.  
  31952.    * A symbol name as a string.  The name can be specified either with
  31953.      or without the leading underscore `_'.
  31954.  
  31955.    * A register name `%REG'.  REG specifies the value of one of the
  31956.      debuggee's registers saved in the external variable `a_tss' (*note
  31957.      run_child::.).
  31958.  
  31959.    * Any sensible combination of the above elements, see the example
  31960.      below.
  31961.  
  31962. `syms_name2val' looks up the specified file, line, and symbol in the
  31963. symbol table prepared by `syms_init', finds their addresses, adds the
  31964. offset, if any, and returns the result.
  31965.  
  31966. If the specified file, line, or symbol cannot be found, `syms_name2val'
  31967. returns zero and sets the global variable `undefined_symbol' to a
  31968. non-zero value.  If the global variable `syms_printwhy' is non-zero, an
  31969. error message is printed telling which part of the argument STRING was
  31970. invalid.
  31971.  
  31972. You must call `syms_init' (*note syms_init::.) before calling any of
  31973. the other `syms_*' functions for the first time.
  31974.  
  31975. Return Value
  31976. ------------
  31977.  
  31978. The address specified by STRING, or zero, if none found.
  31979.  
  31980. Portability
  31981. -----------
  31982.  
  31983. not ANSI, not POSIX
  31984.  
  31985. Example
  31986. -------
  31987.  
  31988.       unsigned long addr1, addr2, addr3;
  31989.      
  31990.       syms_init ("foo.exe");
  31991.       addr1 = syms_name2val ("foo.c#256+12");
  31992.       addr2 = syms_name2val ("_main");
  31993.       addr3 = syms_name2val ("struct_a_var+%eax+4");
  31994.  
  31995. 
  31996. File: libc.info,  Node: syms_val2line,  Next: syms_val2name,  Prev: syms_name2val,  Up: Alphabetical List
  31997.  
  31998. syms_val2line
  31999. =============
  32000.  
  32001. Syntax
  32002. ------
  32003.  
  32004.      #include <debug/syms.h>
  32005.      
  32006.      char *syms_val2line (unsigned long addr, int *line, int exact);
  32007.  
  32008. Description
  32009. -----------
  32010.  
  32011. This function takes an address ADDR and returns the source file name
  32012. which correspond to that address.  The line number in that source file
  32013. is stored in the variable pointed by LINE.  If EXACT is non-zero, the
  32014. function succeeds only if ADDR is the first address which corresponds
  32015. to some source line.
  32016.  
  32017. You must call `syms_init' (*note syms_init::.) before calling any of
  32018. the other `syms_*' functions for the first time.
  32019.  
  32020. Return Value
  32021. ------------
  32022.  
  32023. The name of the source file which corresponds to ADDR, or `NULL' if
  32024. none was found.
  32025.  
  32026. Portability
  32027. -----------
  32028.  
  32029. not ANSI, not POSIX
  32030.  
  32031. Example
  32032. -------
  32033.  
  32034.        int lineno;
  32035.        char *file_name;
  32036.        syms_init ("foo.exe");
  32037.        file_name = syms_val2line (0x1c12, &lineno);
  32038.        printf ("The address %x is on %s, line %d\n", 0x1c12, file_name, line);
  32039.  
  32040. 
  32041. File: libc.info,  Node: syms_val2name,  Next: sync,  Prev: syms_val2line,  Up: Alphabetical List
  32042.  
  32043. syms_val2name
  32044. =============
  32045.  
  32046. Syntax
  32047. ------
  32048.  
  32049.      #include <debug/syms.h>
  32050.      
  32051.      char *syms_val2name (unsigned long addr, unsigned long *offset);
  32052.  
  32053. Description
  32054. -----------
  32055.  
  32056. This function takes an address ADDR and returns the name of the closest
  32057. symbol whose address is less that ADDR.  If OFFSET is not a `NULL'
  32058. pointer, the offset of ADDR from the symbol's address is stored in the
  32059. variable pointed to by OFFSET.
  32060.  
  32061. You must call `syms_init' (*note syms_init::.) before calling any of
  32062. the other `syms_*' functions for the first time.
  32063.  
  32064. This function is meant to be used to convert numerical addresses into
  32065. function names and offsets into their code, like what `symify' does
  32066. with the call frame traceback.
  32067.  
  32068. The function ignores several dummy symbols, like `_end' and `_etext'.
  32069.  
  32070. Return Value
  32071. ------------
  32072.  
  32073. The name of the found symbol, or the printed hexadecimal representation
  32074. of ADDR, if no symbol was found near ADDR.  The return value is a
  32075. pointer to a static buffer, so don't overwrite it and don't pass it to
  32076. `free'!
  32077.  
  32078. Portability
  32079. -----------
  32080.  
  32081. not ANSI, not POSIX
  32082.  
  32083. Example
  32084. -------
  32085.  
  32086.        unsigned long offs;
  32087.        char *symbol_name;
  32088.        syms_init ("foo.exe");
  32089.        symbol_name = syms_val2name (0x1c12, &offs);
  32090.        printf ("The address %x is at %s%+ld\n", 0x1c12, symbol_name, offs);
  32091.  
  32092. 
  32093. File: libc.info,  Node: sync,  Next: sys_errlist,  Prev: syms_val2name,  Up: Alphabetical List
  32094.  
  32095. sync
  32096. ====
  32097.  
  32098. Syntax
  32099. ------
  32100.  
  32101.      #include <unistd.h>
  32102.      
  32103.      int sync(void);
  32104.  
  32105. Description
  32106. -----------
  32107.  
  32108. Intended to assist porting Unix programs.  Under Unix, `sync' flushes
  32109. all caches of previously written data.  In this implementation, `sync'
  32110. calls `fsync' on every open file.  *Note fsync::.  It also calls
  32111. `_flush_disk_cache' (*note _flush_disk_cache::.) to try to force cached
  32112. data to the disk.
  32113.  
  32114. Return Value
  32115. ------------
  32116.  
  32117. Always returns 0.
  32118.  
  32119. Portability
  32120. -----------
  32121.  
  32122. not ANSI, not POSIX
  32123.  
  32124. Example
  32125. -------
  32126.  
  32127.      sync();
  32128.  
  32129. 
  32130. File: libc.info,  Node: sys_errlist,  Next: sys_nerr,  Prev: sync,  Up: Alphabetical List
  32131.  
  32132. sys_errlist
  32133. ===========
  32134.  
  32135. Syntax
  32136. ------
  32137.  
  32138.      #include <errno.h>
  32139.      
  32140.      extern char *sys_errlist[];
  32141.  
  32142. Description
  32143. -----------
  32144.  
  32145. This array contains error messages, indexed by `errno', that describe
  32146. the errors.
  32147.  
  32148. Portability
  32149. -----------
  32150.  
  32151. not ANSI, not POSIX
  32152.  
  32153. Example
  32154. -------
  32155.  
  32156.      printf("Error: %s\n", sys_errlist[errno]);
  32157.  
  32158. 
  32159. File: libc.info,  Node: sys_nerr,  Next: sysconf,  Prev: sys_errlist,  Up: Alphabetical List
  32160.  
  32161. sys_nerr
  32162. ========
  32163.  
  32164. Syntax
  32165. ------
  32166.  
  32167.      #include <errno.h>
  32168.      
  32169.      extern int sys_nerr;
  32170.  
  32171. Description
  32172. -----------
  32173.  
  32174. This variable gives the number of error messages in `sys_errlist'
  32175. (*note sys_errlist::.).
  32176.  
  32177. Portability
  32178. -----------
  32179.  
  32180. not ANSI, not POSIX
  32181.  
  32182. Example
  32183. -------
  32184.  
  32185.      if (errno < sys_nerr)
  32186.        printf("Error: %s\n", sys_errlist[errno]);
  32187.  
  32188. 
  32189. File: libc.info,  Node: sysconf,  Next: system,  Prev: sys_nerr,  Up: Alphabetical List
  32190.  
  32191. sysconf
  32192. =======
  32193.  
  32194. Syntax
  32195. ------
  32196.  
  32197.      #include <unistd.h>
  32198.      
  32199.      long sysconf(int which);
  32200.  
  32201. Description
  32202. -----------
  32203.  
  32204. This function returns various system configuration values, based on
  32205. WHICH:
  32206.  
  32207.        case _SC_ARG_MAX:    return _go32_info_block.size_of_transfer_buffer;
  32208.        case _SC_CHILD_MAX:    return CHILD_MAX;
  32209.        case _SC_CLK_TCK:    return CLOCKS_PER_SEC;
  32210.        case _SC_NGROUPS_MAX:    return NGROUPS_MAX;
  32211.        case _SC_OPEN_MAX:    return 255;
  32212.        case _SC_JOB_CONTROL:    return -1;
  32213.        case _SC_SAVED_IDS:    return -1;
  32214.        case _SC_STREAM_MAX:    return _POSIX_STREAM_MAX;
  32215.        case _SC_TZNAME_MAX:    return TZNAME_MAX;
  32216.        case _SC_VERSION:    return _POSIX_VERSION;
  32217.  
  32218. Return Value
  32219. ------------
  32220.  
  32221. The value.
  32222.  
  32223. Portability
  32224. -----------
  32225.  
  32226. not ANSI, POSIX
  32227.  
  32228. 
  32229. File: libc.info,  Node: system,  Next: tan,  Prev: sysconf,  Up: Alphabetical List
  32230.  
  32231. system
  32232. ======
  32233.  
  32234. Syntax
  32235. ------
  32236.  
  32237.      #include <stdlib.h>
  32238.      
  32239.      int system(const char *cmd);
  32240.  
  32241. Description
  32242. -----------
  32243.  
  32244. This function runs the command or program specified by CMD.  If CMD is
  32245. a null pointer, `system' returns non-zero only if a shell is available.
  32246. If CMD is an empty string, the command processor pointed to by `SHELL'
  32247. or `COMSPEC' variables in the environment will be invoked
  32248. interactively; type `exit <RET>' to return to the program which called
  32249. `system'.  (Note that some other DOS compilers treat a null pointer
  32250. like an empty command line, contrary to ANSI C requirements.)
  32251.  
  32252. When calling programs compiled by DJGPP this function will not use
  32253. `COMMAND.COM' and so will not be subject to its 126 character limit on
  32254. command lines.
  32255.  
  32256. Command lines and pipes (i.e., the use of `<', `>', `>>', and `|') will
  32257. be simulated internally in this function; this means that you can have
  32258. both long command lines and redirection/pipes when running DJGPP
  32259. programs with this function.
  32260.  
  32261. By default, `COMMAND.COM' will only be invoked to run commands internal
  32262. to it, or to run batch files (but this can be changed, see below).  In
  32263. these cases, the returned error code will always be zero, since
  32264. `COMMAND.COM' always exits with code 0.
  32265.  
  32266. Certain commands internal to `COMMAND.COM' that don't make sense or
  32267. cause no effect in the context of `system' are ignored by this
  32268. function.  These are `REM', `EXIT', `GOTO', `SHIFT'; `SET', `PATH' and
  32269. `PROMPT' are ignored only if called with an argument.  You can disable
  32270. this feature if you need, see below.
  32271.  
  32272. Some commands are emulated internally by `system', because the
  32273. emulation is better than the original.  Currently, the only emulated
  32274. command is `CD' or `CHDIR': the emulation knows about forward slashes
  32275. and also switches the current drive.  This emulation can also be
  32276. switched off, as explained below.
  32277.  
  32278. When `system' is presented with an internal shell command, it checks
  32279. the environment variables `SHELL' and `COMSPEC' (in that order) and
  32280. invokes the program that they point to.  If the shell thus found is one
  32281. of the DOS shells (`COMMAND.COM', `4DOS' or `NDOS'), they are called
  32282. with the `/c' switch prepended to the command line.  Otherwise,
  32283. `system' assumes that the shell is a Unix-style shell and passes it the
  32284. entire command line via a temporary file, invoking the shell with a
  32285. single argument which is the name of that file.
  32286.  
  32287. Shell scripts and batch files are invoked by calling either the program
  32288. whose name appears on the first line (like in `#! /bin/sh'), or the
  32289. default shell if none is specified by the script.  If the name of the
  32290. shell specified by the script is a Unix-style pathname, without a drive
  32291. letter and with no extension, `system' will additionally search for it
  32292. on the `PATH'.  This allows to invoke Unix shell scripts unmodified, if
  32293. you have a ported shell installed on your system.
  32294.  
  32295. You can customize the behavior of `system' using a bit-mapped variable
  32296. `__system_flags', defined on `<stdlib.h>'.  The following bits are
  32297. currently defined:
  32298.  
  32299. `__system_redirect'
  32300.      When set (the default), specifies that `system' can use its
  32301.      internal redirection and pipe code.  If reset, any command line
  32302.      that includes an unquoted redirection symbol will be passed to the
  32303.      shell.
  32304.  
  32305. `__system_call_cmdproc'
  32306.      When set, `system' will always call the shell to execute the
  32307.      command line.  If reset (the default), the shell will only be
  32308.      called when needed, as described above.
  32309.  
  32310.      You should *always* set this bit if you use a real, Unix-style
  32311.      shell (also, set `__system_use_shell', described below, and the
  32312.      `SHELL' environment variable).
  32313.  
  32314. `__system_use_shell'
  32315.      When set (the default), the `SHELL' environment variable will take
  32316.      precedence upon `COMSPEC'; this allows you to specify a special
  32317.      shell for `system' that doesn't affect the rest of DOS.  If reset,
  32318.      only `COMSPEC' is used to find the name of the command processor.
  32319.  
  32320. `__system_allow_multiple_cmds'
  32321.      When set, you can put multiple commands together separated by the
  32322.      `;' character.  If reset (the default), the command line passed to
  32323.      `system' is executed as a single command and `;' has no special
  32324.      meaning.
  32325.  
  32326. `__system_allow_long_cmds'
  32327.      When set (the default), `system' will handle command lines longer
  32328.      than the DOS 126-character limit; this might crash your program in
  32329.      some cases, as the low-level functions that invoke the child
  32330.      program will only pass them the first 126 characters.  When reset,
  32331.      `system' will detect early that the command line is longer than
  32332.      126 characters and refuse to run it, but you will not be able to
  32333.      call DJGPP programs with long command lines.
  32334.  
  32335. `__system_emulate_command'
  32336.      If reset (the default), `system' will pass the entire command line
  32337.      to the shell if its name is one of the following: `sh.exe',
  32338.      `sh16.exe', `sh32.exe', `bash.exe', `tcsh.exe'.  When set,
  32339.      `system' will attempt to emulate redirection and pipes internally,
  32340.      even if `COMSPEC' or `SHELL' point to a Unix-style shell.
  32341.  
  32342. `__system_handle_null_commands'
  32343.      When set (the default), commands internal to `COMMAND.COM' and
  32344.      compatible shells which have no effect in the context of `system',
  32345.      are ignored (the list of these commands was given above).  If
  32346.      reset, these commands are processed as all others, which means
  32347.      `COMMAND.COM' will be called to execute them.
  32348.  
  32349.      Note that this bit shouldn't be used with a Unix-style shell,
  32350.      because it does the wrong thing then.  With Unix-style shells, you
  32351.      are supposed to set the `__system_call_cmdproc' bit which will
  32352.      always call the shell.
  32353.  
  32354. `__system_ignore_chdir'
  32355.      If set, the `CD' and `CHDIR' commands are ignored.  When reset
  32356.      (the default), the processing of these commands depends on the
  32357.      `__system_emulate_chdir' bit, see below.
  32358.  
  32359.      This bit is for compatibility with Unix, where a single `cd dir'
  32360.      command has no effect, because the current working directory there
  32361.      is not a global notion (as on MSDOS).  Don't set this bit if you
  32362.      use multiple commands (see `__system_allow_multiple_cmds' above).
  32363.  
  32364. `__system_emulate_chdir'
  32365.      When set, the `CD' and `CHDIR' commands are emulated internally:
  32366.      they change the drive when the argument specifies a drive letter,
  32367.      and they support both forward slashes and backslashes in
  32368.      pathnames.  When `CD' is called without an argument, it prints the
  32369.      current working directory with forward slashes and down-cases DOS
  32370.      8+3 names.  If this bit is reset (the default), `CD' and `CHDIR'
  32371.      are passed to the shell.
  32372.  
  32373. The behavior of `system' can be customized at run time by defining the
  32374. variable `DJSYSFLAGS' in the environment.  The value of that variable
  32375. should be the numerical value of `__system_flags' that you'd like to
  32376. set; it will override the value of `__system_flags' specified when the
  32377. program was compiled.
  32378.  
  32379. Return Value
  32380. ------------
  32381.  
  32382. If CMD is a null pointer, `system' returns non-zero if a shell is
  32383. available.  The actual test for the existence of an executable file
  32384. pointed to by `SHELL' or `COMSPEC' is only performed if the shell is to
  32385. be invoked to process the entire command line; if most of the work is
  32386. to be done by `system' itself, passing a null pointer always yields a
  32387. non-zero return value, since the internal emulation is always
  32388. "available".
  32389.  
  32390. Otherwise, the return value is the exit status of the child process in
  32391. its lower 8 bits; bits 8-17 of the return value will hold `SIGINT' or
  32392. `SIGABRT' if the child process was aborted by `Ctrl-C' or Critical
  32393. Device Error, respectively; otherwise they will be zero(1).  If the
  32394. child couldn't be run, `system' will return -1 and set `errno' to an
  32395. appropriate value.  Note that if `COMMAND.COM' was used to run the
  32396. child, it will always return a 0 status, even if the command didn't run
  32397. successfully.  However, `system' only calls `COMMAND.COM' when it needs
  32398. to run commands internal to it.
  32399.  
  32400. Portability
  32401. -----------
  32402.  
  32403. ANSI, POSIX
  32404.  
  32405. Example
  32406. -------
  32407.  
  32408.      system("cc1plus.exe @cc123456.gp");
  32409.  
  32410. ---------- Footnotes ----------
  32411.  
  32412. (1) Many DOS programs catch `Ctrl-C' keystrokes and Critical Errors, and
  32413. handle them in customized ways.  If this handling prevents DOS from
  32414. realizing that the program was aborted due to these reasons, bits 8-17
  32415. of the value returned by `system' will most probably be zero.  Don't
  32416. count on these bits to hold the signal number!
  32417.  
  32418. 
  32419. File: libc.info,  Node: tan,  Next: tanh,  Prev: system,  Up: Alphabetical List
  32420.  
  32421. tan
  32422. ===
  32423.  
  32424. Syntax
  32425. ------
  32426.  
  32427.      #include <math.h>
  32428.      
  32429.      double tan(double x);
  32430.  
  32431. Description
  32432. -----------
  32433.  
  32434. This function computes the tangent of X (which should be given in
  32435. radians).
  32436.  
  32437. Return Value
  32438. ------------
  32439.  
  32440. The tangent of X.  If the absolute value of X is finite but greater
  32441. than or equal to 2^63, the return value is 0 (since for arguments that
  32442. large each bit of the mantissa is more than `Pi').  If the value of X
  32443. is infinite or `NaN', the return value is `NaN' and `errno' is set to
  32444. `EDOM'.
  32445.  
  32446. Portability
  32447. -----------
  32448.  
  32449. ANSI, POSIX
  32450.  
  32451. 
  32452. File: libc.info,  Node: tanh,  Next: tcdrain,  Prev: tan,  Up: Alphabetical List
  32453.  
  32454. tanh
  32455. ====
  32456.  
  32457. Syntax
  32458. ------
  32459.  
  32460.      #include <math.h>
  32461.      
  32462.      double tanh(double x);
  32463.  
  32464. Description
  32465. -----------
  32466.  
  32467. This function computes the hyperbolic tangent of X.
  32468.  
  32469. Return Value
  32470. ------------
  32471.  
  32472. The hyperbolic tangent of X.  If X is either a positive or a negative
  32473. infinity, the result is unity with the same sign as X, and `errno' is
  32474. not changed.  If X is `NaN', the return value is `NaN' and `errno' is
  32475. set to `EDOM'.
  32476.  
  32477. Portability
  32478. -----------
  32479.  
  32480. ANSI, POSIX
  32481.  
  32482. 
  32483. File: libc.info,  Node: tcdrain,  Next: tcflow,  Prev: tanh,  Up: Alphabetical List
  32484.  
  32485. tcdrain
  32486. =======
  32487.  
  32488. Syntax
  32489. ------
  32490.  
  32491.      #include <termios.h>
  32492.      
  32493.      int tcdrain (int fd);
  32494.  
  32495. Description
  32496. -----------
  32497.  
  32498. This function waits until all the output is written to the file/device
  32499. referred to by the handle FD.  In this implementation, this function
  32500. does nothing except checking the validity of its arguments; it is
  32501. provided for compatibility only.  Note that the termios emulation
  32502. handles console only.
  32503.  
  32504. Return Value
  32505. ------------
  32506.  
  32507. Zero on success, nonzero on failure.
  32508.  
  32509. Portability
  32510. -----------
  32511.  
  32512. not ANSI, POSIX
  32513.  
  32514. 
  32515. File: libc.info,  Node: tcflow,  Next: tcflush,  Prev: tcdrain,  Up: Alphabetical List
  32516.  
  32517. tcflow
  32518. ======
  32519.  
  32520. Syntax
  32521. ------
  32522.  
  32523.      #include <termios.h>
  32524.      
  32525.      int tcflow (int fd, int action);
  32526.  
  32527. Description
  32528. -----------
  32529.  
  32530. This function suspends transmission of data to, or reception of data
  32531. from, the device/file open on handle FD.  The ACTION argument can take
  32532. one of these values:
  32533.  
  32534. `TCOOFF'
  32535.      the output is suspended
  32536.  
  32537. `TCOON'
  32538.      the output is resumed
  32539.  
  32540. `TCIOFF'
  32541.      the STOP character is transmitted
  32542.  
  32543. `TCION'
  32544.      the START character is transmitted
  32545.  
  32546. The current START and STOP characters are stored in the `termios'
  32547. structure that is currently in effect.  *Note Termios functions::, for
  32548. more details about that.
  32549.  
  32550. Note that the DJGPP termios emulation handles console only.
  32551.  
  32552. Return Value
  32553. ------------
  32554.  
  32555. Zero on success, nonzero on failure.
  32556.  
  32557. Portability
  32558. -----------
  32559.  
  32560. not ANSI, POSIX
  32561.  
  32562. 
  32563. File: libc.info,  Node: tcflush,  Next: tcgetattr,  Prev: tcflow,  Up: Alphabetical List
  32564.  
  32565. tcflush
  32566. =======
  32567.  
  32568. Syntax
  32569. ------
  32570.  
  32571.      #include <termios.h>
  32572.      
  32573.      int tcflush (int fd, int which);
  32574.  
  32575. Description
  32576. -----------
  32577.  
  32578. This function clears the input and/or output queues on for the
  32579. device/file open on handle FD.  The WHICH argument can take these
  32580. values:
  32581.  
  32582. `TCIFLUSH'
  32583.      the unprocessed characters in the input buffer are discarded
  32584.  
  32585. `TCOFLUSH'
  32586.      no effect (provided for compatibility)
  32587.  
  32588. `TCIOFLUSH'
  32589.      has the combined effect of `TCIFLUSH' and `TCOFLUSH'
  32590.  
  32591. Note that the termios emulation handles console only.
  32592.  
  32593. Return Value
  32594. ------------
  32595.  
  32596. Zero on success, nonzero on failure.
  32597.  
  32598. Portability
  32599. -----------
  32600.  
  32601. not ANSI, POSIX
  32602.  
  32603. 
  32604. File: libc.info,  Node: tcgetattr,  Next: tcgetpgrp,  Prev: tcflush,  Up: Alphabetical List
  32605.  
  32606. tcgetattr
  32607. =========
  32608.  
  32609. Syntax
  32610. ------
  32611.  
  32612.      #include <termios.h>
  32613.      
  32614.      int tcgetattr (int fd, struct termios *termiosp);
  32615.  
  32616. Description
  32617. -----------
  32618.  
  32619. This function gets the parameters associated with the file/device
  32620. referred to by the handle FD and stores them in the termios structure
  32621. TERMIOSP.  *Note Termios functions::, for the full description of
  32622. `struct termios' and its members.
  32623.  
  32624. Note that the termios emulation handles console only.
  32625.  
  32626. Return Value
  32627. ------------
  32628.  
  32629. Zero on success, nonzero on failure.
  32630.  
  32631. Portability
  32632. -----------
  32633.  
  32634. not ANSI, POSIX
  32635.  
  32636. Example
  32637. -------
  32638.  
  32639.      struct termios termiosbuf;
  32640.      int rc = tcgetattr (0, &termiosbuf);
  32641.  
  32642. 
  32643. File: libc.info,  Node: tcgetpgrp,  Next: tcsendbreak,  Prev: tcgetattr,  Up: Alphabetical List
  32644.  
  32645. tcgetpgrp
  32646. =========
  32647.  
  32648. Syntax
  32649. ------
  32650.  
  32651.      #include <termios.h>
  32652.      
  32653.      int tcgetpgrp (int fd);
  32654.  
  32655. Description
  32656. -----------
  32657.  
  32658. This function returns the value of the "process group ID" for the
  32659. foreground process associated with the terminal.  The file descriptor
  32660. FD must be connected to the terminal, otherwise the function will fail.
  32661.  
  32662. Return Value
  32663. ------------
  32664.  
  32665. If FD is connected to the terminal, the function returns the process
  32666. group ID, which is currently identical to the value returned by
  32667. `getpgrp()' (*note getpgrp::.).  Otherwise, it returns -1 and sets
  32668. `errno' to `ENOTTY'.
  32669.  
  32670. Portability
  32671. -----------
  32672.  
  32673. not ANSI, POSIX
  32674.  
  32675. 
  32676. File: libc.info,  Node: tcsendbreak,  Next: tcsetattr,  Prev: tcgetpgrp,  Up: Alphabetical List
  32677.  
  32678. tcsendbreak
  32679. ===========
  32680.  
  32681. Syntax
  32682. ------
  32683.  
  32684.      #include <termios.h>
  32685.      
  32686.      int tcsendbreak (int fd, int duration);
  32687.  
  32688. Description
  32689. -----------
  32690.  
  32691. This function generates a break condition for `DURATION*0.25' seconds.
  32692. In the current implementation this function does nothing; it is
  32693. provided for compatibility only.  Note that the termios emulation
  32694. handles console only.
  32695.  
  32696. Return Value
  32697. ------------
  32698.  
  32699. Zero on success, nonzero on failure.
  32700.  
  32701. Portability
  32702. -----------
  32703.  
  32704. not ANSI, POSIX
  32705.  
  32706. 
  32707. File: libc.info,  Node: tcsetattr,  Next: tcsetpgrp,  Prev: tcsendbreak,  Up: Alphabetical List
  32708.  
  32709. tcsetattr
  32710. =========
  32711.  
  32712. Syntax
  32713. ------
  32714.  
  32715.      #include <termios.h>
  32716.      
  32717.      int tcsetattr (int fd, int action, const struct termios *termiosp);
  32718.  
  32719. Description
  32720. -----------
  32721.  
  32722. This function sets termios structure for device open on the handle FD
  32723. from the structure TERMIOSP.  Note that the termios emulation handles
  32724. console only.
  32725.  
  32726. The ACTION argument can accept the following values:
  32727.  
  32728. `TCSANOW'
  32729.  
  32730. `TCSADRAIN'
  32731.  
  32732. `TCSAFLUSH'
  32733. Currently, any of these values causes the values in TERMIOSP to take
  32734. effect immediately.
  32735.  
  32736. *Note Termios functions::, for the description of the `struct termios'
  32737. structure.
  32738.  
  32739. Return Value
  32740. ------------
  32741.  
  32742. Zero on success, nonzero on failure.
  32743.  
  32744. Portability
  32745. -----------
  32746.  
  32747. not ANSI, POSIX
  32748.  
  32749. Example
  32750. -------
  32751.  
  32752.      tcsetattr (0, TCSANOW, &termiosbuf);
  32753.  
  32754. 
  32755. File: libc.info,  Node: tcsetpgrp,  Next: tell,  Prev: tcsetattr,  Up: Alphabetical List
  32756.  
  32757. tcsetpgrp
  32758. =========
  32759.  
  32760. Syntax
  32761. ------
  32762.  
  32763.      #include <termios.h>
  32764.      
  32765.      int tcsetpgrp (int fd, pid_t pgroup_id);
  32766.  
  32767. Description
  32768. -----------
  32769.  
  32770. This function sets the foreground "process group ID" for the terminal
  32771. connected to file descriptor FD.  FD must be a valid handle connected
  32772. to a terminal device, and PGROUP_ID must be the process group ID of the
  32773. calling process, or the function will fail.
  32774.  
  32775. Return Value
  32776. ------------
  32777.  
  32778. If FD is a valid handle connected to a terminal and PGROUP_ID is equal
  32779. to what `getpgrp()' returns (*note getpgrp::.), the function will do
  32780. nothing and return zero.  Otherwise, -1 will be returned and `errno'
  32781. will be set to a suitable value.  In particular, if the PGROUP_ID
  32782. argument is different from what `getpgrp()' returns, `tcsetpgrp' sets
  32783. `errno' to `ENOSYS'.
  32784.  
  32785. Portability
  32786. -----------
  32787.  
  32788. not ANSI, POSIX
  32789.  
  32790. 
  32791. File: libc.info,  Node: tell,  Next: telldir,  Prev: tcsetpgrp,  Up: Alphabetical List
  32792.  
  32793. tell
  32794. ====
  32795.  
  32796. Syntax
  32797. ------
  32798.  
  32799.      #include <io.h>
  32800.      
  32801.      off_t tell(int file);
  32802.  
  32803. Description
  32804. -----------
  32805.  
  32806. This function returns the location of the file pointer for FILE.
  32807.  
  32808. Return Value
  32809. ------------
  32810.  
  32811. The file pointer, or -1 on error.
  32812.  
  32813. Portability
  32814. -----------
  32815.  
  32816. not ANSI, not POSIX
  32817.  
  32818. Example
  32819. -------
  32820.  
  32821.      off_t q = tell(fd);
  32822.  
  32823. 
  32824. File: libc.info,  Node: telldir,  Next: tempnam,  Prev: tell,  Up: Alphabetical List
  32825.  
  32826. telldir
  32827. =======
  32828.  
  32829. Syntax
  32830. ------
  32831.  
  32832.      #include <dirent.h>
  32833.      
  32834.      long telldir(DIR *dir);
  32835.  
  32836. Description
  32837. -----------
  32838.  
  32839. This function returns a value which indicates the position of the
  32840. pointer in the given directory.  This value is only useful as an
  32841. argument to `seekdir' (*note seekdir::.).
  32842.  
  32843. Return Value
  32844. ------------
  32845.  
  32846. The directory pointer.
  32847.  
  32848. Portability
  32849. -----------
  32850.  
  32851. not ANSI, not POSIX
  32852.  
  32853. Example
  32854. -------
  32855.  
  32856.      DIR *dir;
  32857.      long q = telldir(dir);
  32858.      do_something();
  32859.      seekdir(dir, q);
  32860.  
  32861. 
  32862. File: libc.info,  Node: tempnam,  Next: Termios functions,  Prev: telldir,  Up: Alphabetical List
  32863.  
  32864. tempnam
  32865. =======
  32866.  
  32867. Syntax
  32868. ------
  32869.  
  32870.      #include <stdio.h>
  32871.      
  32872.      char * tempnam(const char *tmpdir, const char *prefix);
  32873.  
  32874. Description
  32875. -----------
  32876.  
  32877. This function generates a file name which can be used for a temporary
  32878. file, and makes sure that no other file by that name exists.
  32879.  
  32880. The caller has control on the choice of the temporary file's directory,
  32881. and the initial letters of the file's basename.  If the argument TMPDIR
  32882. points to the name of the directory in which the temporary file will be
  32883. created, `tempnam' will ensure that the generate name is unique *in
  32884. that directory*.  If the argument PREFIX points to a string, then that
  32885. string will be used as the first few characters of the file's basename.
  32886. Due to limitations of the DOS 8.3 file namespace, only up to two first
  32887. characters in PREFIX will be used.
  32888.  
  32889. If TMPDIR is `NULL', or empty, or points to a non-existent directory,
  32890. `tempnam' will use a default directory.  The default directory is
  32891. determined by testing, in sequence, the directories defined by the
  32892. values of environment variables `TMPDIR', `TEMP' and `TMP'.  The first
  32893. variable that is found to point to an existing directory will be used.
  32894. If none of these variables specify a valid directory, `tempnam' will
  32895. use the static default path prefix defined by `P_tmpdir' on
  32896. `<stdio.h>', or `"c:/"', in that order.
  32897.  
  32898. If PREFIX is `NULL' or empty, `tempnam' will supply its own default
  32899. prefix `"tm"'.
  32900.  
  32901. `tempnam' puts the generated name into space allocated by `malloc'.  It
  32902. is up to the caller to free that space when it is no longer needed.
  32903.  
  32904. Note that `tempnam' does not actually create the file, nor does it
  32905. ensure in any way that the file will be automatically deleted when it's
  32906. no longer used.  It is the user's responsibility to do that.
  32907.  
  32908. Return Value
  32909. ------------
  32910.  
  32911. On success, `tempnam' returns a pointer to space (allocated with a call
  32912. to `malloc') where the file name is constructed.  If `malloc' failed to
  32913. provide sufficient memory buffer, or if no valid directory to hold the
  32914. file was found, `tempnam' returns a `NULL' pointer.
  32915.  
  32916. Portability
  32917. -----------
  32918.  
  32919. not ANSI, not POSIX
  32920.  
  32921. Example
  32922. -------
  32923.  
  32924.        #include <stdio.h>
  32925.      
  32926.          tempnam ("c:/tmp/", "foo");
  32927.  
  32928. 
  32929. File: libc.info,  Node: Termios functions,  Next: textattr,  Prev: tempnam,  Up: Alphabetical List
  32930.  
  32931. Termios functions
  32932. =================
  32933.  
  32934. The `termios' functions allow to control terminals and asynchronous
  32935. communications ports.  The DJGPP implementation currently supports the
  32936. `termios' functionality for console devices only.  It does that by
  32937. reading the keyboard via the BIOS Int 16h and writes to the screen via
  32938. the direct output interrupt 29h.  This I/O redirection is performed by
  32939. the special hook internal to the library.
  32940.  
  32941. Many of the `termios' functions accept a TERMIOSP argument which is a
  32942. pointer to a `struct termios' variable.  Here's the description of this
  32943. structure:
  32944.  
  32945.       #define NCCS 12
  32946.       struct termios {
  32947.         cc_t            c_cc[NCCS];  /* control characters */
  32948.         tcflag_t     c_cflag;     /* control modes */
  32949.         tcflag_t     c_iflag;     /* input modes */
  32950.         tcflag_t     c_lflag;     /* local modes */
  32951.         tcflag_t     c_oflag;     /* output modes */
  32952.         speed_t      c_ispeed;    /* input baudrate */
  32953.         speed_t      c_ospeed;    /* output baudrate */
  32954.       }
  32955.  
  32956. The array `c_cc[]' defines the special control characters.  the
  32957. following table lists the supported control functions the default
  32958. characters which invoke those functions, and the default values for MIN
  32959. and TIME parameters:
  32960.  
  32961. Index  Name    Function                   Default    
  32962.                                           Value      
  32963. 1      VEOF    Signal End-Of-Input        Ctrl-D     
  32964. 2      VEOL    Signal End-Of-Line         [Disabled] 
  32965. 3      VERASE  Delete previous character  Backspace  
  32966. 4      VINTR   Generate SIGINT            Ctrl-C     
  32967. 5      VKILL   Erase current line         Ctrl-U     
  32968. 6      VMIN    The MIN value              1          
  32969. 7      VQUIT   Generate SIGQUIT           Ctrl-\     
  32970. 8      VSTART  Resume output              Ctrl-Q     
  32971. 9      VSTOP   Suspend output             Ctrl-S     
  32972. 10     VSUSP   Suspend program            Ctrl-Z     
  32973. 11     VTIME   TIME value                 0          
  32974.  
  32975. The special characters (like `VEOL', `VKILL', etc.) produce their
  32976. effect only under the "canonical input processing", that is, when the
  32977. `ICANON' bit in the `c_lflag' member of `struct termios' (see below) is
  32978. set.  If `ICANON' is *not* set, all characters are processed as regular
  32979. characters and returned to the caller; only the `VMIN' and `VTIME'
  32980. parameters are meaningful in the "non-canonical processing" mode.
  32981.  
  32982. The `VEOL' character can be used to signal end of line (and thus end of
  32983. input in the canonical mode) in addition to the normal `RET' key.  In
  32984. the non-canonical mode, input ends as soon as at least `VMIN'
  32985. characters are received.
  32986.  
  32987. Note that the values of `VMIN' and `VTIME' are currently ignored;
  32988. `termios' functions always work as if `VMIN' were 1 and `VTIME' were
  32989. zero.  Other parameters are supported (for console devices only),
  32990. except that VSTOP and VSTART characters are not inserted to the input,
  32991. but otherwise produce no effect.
  32992.  
  32993. The `c_cflag' member of `struct termios' describes the hardware
  32994. terminal control, as follows:
  32995.  
  32996. Symbol  Function                    
  32997. B0      Hang up                     
  32998. B50     50 baud                     
  32999. B75     75 baud                     
  33000. B110    110 baud                    
  33001. B134    134.5 baud                  
  33002. B150    150 baud                    
  33003. B200    200 baud                    
  33004. B300    300 baud                    
  33005. B600    600 baud                    
  33006. B1200   1200 baud                   
  33007. B1800   1800 baud                   
  33008. B2400   2400 baud                   
  33009. B4800   4800 baud                   
  33010. B9600   9600 baud                   
  33011. B19200  19200 baud                  
  33012. B38400  38400 baud                  
  33013. CSIZE   Character size:             
  33014. CS5     5-bit characters            
  33015. CS6     6-bit characters            
  33016. CS7     7-bit characters            
  33017. CS8     8-bit characters            
  33018. CSTOPB  If set, send two stop bits  
  33019. CREAD   Enable reading              
  33020. PARENB  Enable parity               
  33021. PARODD  If set, use odd parity      
  33022. HUPCL   Hang up on last close       
  33023. CLOCAL  If set, line is local       
  33024.  
  33025. Note that since the DOS terminal doesn't use asynchronous ports, the
  33026. above parameters are always ignored by the implementation.  The default
  33027. value of `c_cflag' is `(CS8|CREAD|CLOCAL)'.
  33028.  
  33029. The `c_lflag' member of `struct termios' defines the local modes that
  33030. control the terminal functions:
  33031.  
  33032. Symbol  Function                                     
  33033. ISIG    If set, enable signals SIGINT and SIGQUIT    
  33034. ICANON  If set, enable canonical input processing    
  33035. ECHO    If set, enable echoing                       
  33036. ECHOE   Erase character deletes                      
  33037. ECHOK   Output newline after the kill character      
  33038. ECHONL  Echo the newline                             
  33039. NOFLSH  [Ignored]                                    
  33040. TOSTOP  [Ignored]                                    
  33041. ECHOCTL Echo control characters as ^X                
  33042. ECHOKE  Erase killed line                            
  33043. IEXTEN  [Ignored]                                    
  33044.  
  33045. The default value of `c_lflag' is
  33046. `(ISIG|ICANON|ECHO|IEXTEN|ECHOE|ECHOKE|ECHOCTL)'.
  33047.  
  33048. The `c_iflag' member of `struct termios' describes the input control:
  33049.  
  33050. Symbol  Function                               
  33051. IGNBRK  Ignore Ctrl-BREAK                      
  33052. BRKINT  Generate SIGINT on Ctrl-BREAK          
  33053. IGNPAR  [Ignored]                              
  33054. PARMRK  [Ignored]                              
  33055. INPCK   [Ignored]                              
  33056. ISTRIP  Strip the 8th bit from input           
  33057. INLCR   Map NL to CR on input                  
  33058. IGNCR   Ignore CR characters                   
  33059. ICRNL   Map CR to NL on input                  
  33060. IXON    [Ignored]                              
  33061. IXOFF   Enable start/stop input control        
  33062. IMAXBEL Ring the bell if input line too long   
  33063.  
  33064. The default value of `c_iflag' is `(BRKINT|ICRNL|IMAXBEL)'.
  33065.  
  33066. The `c_oflag' member of `struct termios' specifies the output handling:
  33067.  
  33068. Symbol  Function                           
  33069. OPOST   If not set, output characters      
  33070.         verbatim                           
  33071. ONLCR   Map newline to CR-LF pair on       
  33072.         output                             
  33073. OCRNL   Map CR to NL on output             
  33074. ONOEOT  Don't output EOT characters        
  33075.  
  33076. Note that if the `OPOST' bit is not set, all the other flags are
  33077. ignored and the characters are output verbatim.  The default value of
  33078. `c_oflag' is `(OPOST|ONLCR|ONOEOT)'.
  33079.  
  33080. The `c_ispeed' and `c_ospeed' members specify, respectively, the input
  33081. and output baudrate of the terminal.  They are set by default to 9600
  33082. baud, but the value is always ignored by this implementation, since no
  33083. asynchronous ports are used.
  33084.  
  33085. 
  33086. File: libc.info,  Node: textattr,  Next: textbackground,  Prev: Termios functions,  Up: Alphabetical List
  33087.  
  33088. textattr
  33089. ========
  33090.  
  33091. Syntax
  33092. ------
  33093.  
  33094.      #include <conio.h>
  33095.      
  33096.      void textattr(int _attr);
  33097.  
  33098. Description
  33099. -----------
  33100.  
  33101. Sets the attribute used for future writes to the screen:
  33102.  
  33103.      ---- XXXX = foreground color
  33104.      -XXX ---- = background color
  33105.      X--- ---- = 1=blink 0=steady
  33106.  
  33107. The include file <conio.h> contains an enum COLORS that define the
  33108. various values that can be used for these bitfields; light colors can
  33109. only be used for the foreground.
  33110.  
  33111. Portability
  33112. -----------
  33113.  
  33114. not ANSI, not POSIX
  33115.  
  33116. Example
  33117. -------
  33118.  
  33119.      /* blinking white on blue */
  33120.      textattr(BLINK | (BLUE << 4) | WHITE);
  33121.  
  33122. 
  33123. File: libc.info,  Node: textbackground,  Next: textcolor,  Prev: textattr,  Up: Alphabetical List
  33124.  
  33125. textbackground
  33126. ==============
  33127.  
  33128. Syntax
  33129. ------
  33130.  
  33131.      #include <conio.h>
  33132.      
  33133.      void textbackground(int _color);
  33134.  
  33135. Description
  33136. -----------
  33137.  
  33138. Sets just the background of the text attribute. *Note textattr::.
  33139.  
  33140. Portability
  33141. -----------
  33142.  
  33143. not ANSI, not POSIX
  33144.  
  33145. 
  33146. File: libc.info,  Node: textcolor,  Next: textmode,  Prev: textbackground,  Up: Alphabetical List
  33147.  
  33148. textcolor
  33149. =========
  33150.  
  33151. Syntax
  33152. ------
  33153.  
  33154.      #include <conio.h>
  33155.      
  33156.      void textcolor(int _color);
  33157.  
  33158. Description
  33159. -----------
  33160.  
  33161. Sets just the foreground of the text attribute. *Note textattr::.
  33162.  
  33163. Portability
  33164. -----------
  33165.  
  33166. not ANSI, not POSIX
  33167.  
  33168. 
  33169. File: libc.info,  Node: textmode,  Next: time,  Prev: textcolor,  Up: Alphabetical List
  33170.  
  33171. textmode
  33172. ========
  33173.  
  33174. Syntax
  33175. ------
  33176.  
  33177.      #include <conio.h>
  33178.      
  33179.      void textmode(int _mode);
  33180.  
  33181. Description
  33182. -----------
  33183.  
  33184. Sets the text mode of the screen.  _MODE is one of the following:
  33185.  
  33186. `LASTMODE'
  33187.      The text mode which was in effect *before* the last call to
  33188.      `textmode()'.
  33189.  
  33190. `BW40'
  33191.      40-column black and white (on a color screen)
  33192.  
  33193. `C40'
  33194.      40-color color.
  33195.  
  33196. `BW80'
  33197.      80-column black and white (on a color screen)
  33198.  
  33199. `C80'
  33200.      80-column color
  33201.  
  33202. `MONO'
  33203.      The monochrome monitor
  33204.  
  33205. `C4350'
  33206.      80-column, 43- (on EGAs) or 50-row (on VGAs) color
  33207.  
  33208. *Note _set_screen_lines::, for a more versatile method of setting text
  33209. screen dimensions.
  33210.  
  33211. Portability
  33212. -----------
  33213.  
  33214. not ANSI, not POSIX
  33215.  
  33216. 
  33217. File: libc.info,  Node: time,  Next: times,  Prev: textmode,  Up: Alphabetical List
  33218.  
  33219. time
  33220. ====
  33221.  
  33222. Syntax
  33223. ------
  33224.  
  33225.      #include <time.h>
  33226.      
  33227.      time_t time(time_t *t);
  33228.  
  33229. Description
  33230. -----------
  33231.  
  33232. If T is not `NULL', the current time is stored in `*t'.
  33233.  
  33234. Return Value
  33235. ------------
  33236.  
  33237. The current time is returned.
  33238.  
  33239. Portability
  33240. -----------
  33241.  
  33242. ANSI, POSIX
  33243.  
  33244. Example
  33245. -------
  33246.  
  33247.      printf("Time is %d\n", time(0));
  33248.  
  33249. 
  33250. File: libc.info,  Node: times,  Next: tmpfile,  Prev: time,  Up: Alphabetical List
  33251.  
  33252. times
  33253. =====
  33254.  
  33255. Syntax
  33256. ------
  33257.  
  33258.      #include <sys/times.h>
  33259.      
  33260.      clock_t times(struct tms *buf);
  33261.  
  33262. Description
  33263. -----------
  33264.  
  33265. This function returns the number of clock ticks used by the current
  33266. process and all of its children until the moment of call.  The number
  33267. of tics per second is `CLOCKS_PER_SEC', defined on time.h.
  33268.  
  33269. This is the structure in which `times' returns its info:
  33270.  
  33271.      struct  tms {
  33272.        clock_t tms_cstime;
  33273.        clock_t tms_cutime;
  33274.        clock_t tms_stime;
  33275.        clock_t tms_utime;
  33276.      };
  33277.  
  33278. Currently, the elapsed time of the running program is returned in the
  33279. `tms_utime' field, and all other fields return as zero.
  33280.  
  33281. Return Value
  33282. ------------
  33283.  
  33284. The number of elapsed tics since the program started.
  33285.  
  33286. Portability
  33287. -----------
  33288.  
  33289. not ANSI, POSIX
  33290.  
  33291. Example
  33292. -------
  33293.  
  33294.      printf("We used %d seconds of elapsed time\n", times(&buf)/CLOCKS_PER_SEC);
  33295.  
  33296. 
  33297. File: libc.info,  Node: tmpfile,  Next: tmpnam,  Prev: times,  Up: Alphabetical List
  33298.  
  33299. tmpfile
  33300. =======
  33301.  
  33302. Syntax
  33303. ------
  33304.  
  33305.      #include <stdio.h>
  33306.      
  33307.      FILE *tmpfile(void);
  33308.  
  33309. Description
  33310. -----------
  33311.  
  33312. This function opens a temporary file.  It will automatically be removed
  33313. if the file is closed or when the program exits.  The name of the file
  33314. is generated by the same algorithm as described under tmpnam() (*note
  33315. tmpnam::.).
  33316.  
  33317. Return Value
  33318. ------------
  33319.  
  33320. A newly opened file.
  33321.  
  33322. Portability
  33323. -----------
  33324.  
  33325. ANSI, POSIX
  33326.  
  33327. Example
  33328. -------
  33329.  
  33330.      FILE *tmp = tmpfile();
  33331.  
  33332. 
  33333. File: libc.info,  Node: tmpnam,  Next: toascii,  Prev: tmpfile,  Up: Alphabetical List
  33334.  
  33335. tmpnam
  33336. ======
  33337.  
  33338. Syntax
  33339. ------
  33340.  
  33341.      #include <stdio.h>
  33342.      
  33343.      char *tmpnam(char *s);
  33344.  
  33345. Description
  33346. -----------
  33347.  
  33348. This functions generates a string that is a valid file name and that is
  33349. not the same as the name of an existing file.  A different string is
  33350. guaranteed to be produced each time it is called, up to `TMP_MAX' times
  33351. (`TMP_MAX' is defined on stdio.h).  If `tmpnam' is called more than
  33352. TMP_MAX times, the behavior is implementation-dependent (ours just
  33353. wraps around and tries to reuse the same file names from the beginning).
  33354.  
  33355. This function examines the environment to determine the directory in
  33356. which the temporary file will be opened.  It looks for one of the
  33357. variables `"TMPDIR"', `"TEMP"' and `"TMP"', in that order.  The first
  33358. one which is found in the environment will be used on the assumption
  33359. that it points to a directory.  If neither of the above variables is
  33360. defined, `tmpnam' defaults to the "c:/" directory (which under MS-DOS
  33361. might mean that it fails to generate TMP_MAX unique names, because DOS
  33362. root directories cannot grow beyond certain limits).
  33363.  
  33364. Return Value
  33365. ------------
  33366.  
  33367. If S is a null pointer, `tmpnam' leaves its result in an internal
  33368. static buffer and returns a pointer to that buffer.  If S is not a null
  33369. pointer, it is assumed to point to an array of at least `L_tmpnam'
  33370. characters, and `tmpnam' writes its result in that array and returns a
  33371. pointer to it as its value.
  33372.  
  33373. Portability
  33374. -----------
  33375.  
  33376. ANSI, POSIX
  33377.  
  33378. Example
  33379. -------
  33380.  
  33381.      char buf[L_tmpnam];
  33382.      char *s = tmpnam(buf);
  33383.  
  33384. 
  33385. File: libc.info,  Node: toascii,  Next: tolower,  Prev: tmpnam,  Up: Alphabetical List
  33386.  
  33387. toascii
  33388. =======
  33389.  
  33390. Syntax
  33391. ------
  33392.  
  33393.      #include <ctype.h>
  33394.      
  33395.      int toascii(int c);
  33396.  
  33397. Description
  33398. -----------
  33399.  
  33400. This function strips the high bit of C, forcing it to be an ASCII
  33401. character.
  33402.  
  33403. Return Value
  33404. ------------
  33405.  
  33406. The ASCII character.
  33407.  
  33408. Portability
  33409. -----------
  33410.  
  33411. not ANSI, not POSIX
  33412.  
  33413. Example
  33414. -------
  33415.  
  33416.      for (i=0; buf[i]; i++)
  33417.        buf[i] = toascii(buf[i]);
  33418.  
  33419. 
  33420. File: libc.info,  Node: tolower,  Next: toupper,  Prev: toascii,  Up: Alphabetical List
  33421.  
  33422. tolower
  33423. =======
  33424.  
  33425. Syntax
  33426. ------
  33427.  
  33428.      #include <ctype.h>
  33429.      
  33430.      int tolower(int c);
  33431.  
  33432. Description
  33433. -----------
  33434.  
  33435. This function returns C, converting it to lower case if it is upper
  33436. case.  *Note toupper::.
  33437.  
  33438. Return Value
  33439. ------------
  33440.  
  33441. The lower case letter.
  33442.  
  33443. Portability
  33444. -----------
  33445.  
  33446. ANSI, POSIX
  33447.  
  33448. Example
  33449. -------
  33450.  
  33451.      for (i=0; buf[i]; i++)
  33452.        buf[i] = tolower(buf[i]);
  33453.  
  33454. 
  33455. File: libc.info,  Node: toupper,  Next: _truename,  Prev: tolower,  Up: Alphabetical List
  33456.  
  33457. toupper
  33458. =======
  33459.  
  33460. Syntax
  33461. ------
  33462.  
  33463.      #include <ctype.h>
  33464.      
  33465.      int toupper(int c);
  33466.  
  33467. Description
  33468. -----------
  33469.  
  33470. This function returns C, converting it to upper case if it is lower
  33471. case. *Note tolower::.
  33472.  
  33473. Return Value
  33474. ------------
  33475.  
  33476. The upper case letter.
  33477.  
  33478. Portability
  33479. -----------
  33480.  
  33481. ANSI, POSIX
  33482.  
  33483. Example
  33484. -------
  33485.  
  33486.      for (i=0; buf[i]; i++)
  33487.        buf[i] = toupper(buf[i]);
  33488.  
  33489. 
  33490. File: libc.info,  Node: _truename,  Next: truncate,  Prev: toupper,  Up: Alphabetical List
  33491.  
  33492. _truename
  33493. =========
  33494.  
  33495. Syntax
  33496. ------
  33497.  
  33498.      #include <sys/stat.h>
  33499.      
  33500.      char * _truename(const char *path, char *true_path);
  33501.  
  33502. Description
  33503. -----------
  33504.  
  33505. Given a PATH of a file, returns in TRUE_PATH its canonicalized
  33506. pathname, with all letters uppercased, default drive and directory made
  33507. explicit, forward slashes converted to backslashes, asterisks converted
  33508. to appropriate number of of question marks, file and directory names
  33509. truncated to 8.3 if necessary, "." and ".." resolved, extra slashes (but
  33510. the last, if present) removed, SUBSTed, JOINed and ASSIGNed drives
  33511. resolved.  Character devices return as "X:/DEVNAME" (note the forward
  33512. slash!), where X is the CURRENT drive and DEVNAME is the device name
  33513. (e.g.  CON).  This is exactly what DOS TRUENAME command does.  See
  33514. Ralph Brown's Interrupt List for more details.
  33515.  
  33516. The named PATH doesn't have to exist, but the drive, if given as part
  33517. of it, should be a legal DOS drive, as this function hits the disk.
  33518.  
  33519. The function will fail if given a PATH which (1) is an empty string; or
  33520. (2) contains only the drive letter (e.g. "c:"); or (3) has leading
  33521. whitespace.  It will also fail if it couldn't allocate memory required
  33522. for its communication with DOS or for TRUE_PATH (see below).
  33523.  
  33524. Upon success, the function will place the result in TRUE_PATH, if
  33525. that's non-NULL; the buffer should be large enough to contain the
  33526. largest possible pathname (PATH_MAX characters).  If TRUE_PATH is a
  33527. NULL pointer, the space to hold the result will be allocated by calling
  33528. *Note malloc::; it is up to the caller to release the buffer by calling
  33529. *Note free::.
  33530.  
  33531. Return Value
  33532. ------------
  33533.  
  33534. The function returns the pointer to the result.  In case of any failure,
  33535. a NULL pointer is returned, and ERRNO is set.
  33536.  
  33537. Portability
  33538. -----------
  33539.  
  33540. not ANSI, not POSIX
  33541.  
  33542. Example
  33543. -------
  33544.  
  33545.        fprintf(stderr,
  33546.                "True name of %s is %s\n", path, _truename(path, (char *)0));
  33547.  
  33548. 
  33549. File: libc.info,  Node: truncate,  Next: ttyname,  Prev: _truename,  Up: Alphabetical List
  33550.  
  33551. truncate
  33552. ========
  33553.  
  33554. Syntax
  33555. ------
  33556.  
  33557.      #include <unistd.h>
  33558.      
  33559.      int truncate(const char *file, off_t size);
  33560.  
  33561. Description
  33562. -----------
  33563.  
  33564. This function truncates FILE to SIZE bytes.
  33565.  
  33566. Return Value
  33567. ------------
  33568.  
  33569. Zero on success, nonzero on failure.
  33570.  
  33571. Portability
  33572. -----------
  33573.  
  33574. not ANSI, not POSIX
  33575.  
  33576. Example
  33577. -------
  33578.  
  33579.      truncate("/tmp/data.txt", 400);
  33580.  
  33581. 
  33582. File: libc.info,  Node: ttyname,  Next: tzset,  Prev: truncate,  Up: Alphabetical List
  33583.  
  33584. ttyname
  33585. =======
  33586.  
  33587. Syntax
  33588. ------
  33589.  
  33590.      #include <unistd.h>
  33591.      
  33592.      char *ttyname(int file);
  33593.  
  33594. Description
  33595. -----------
  33596.  
  33597. Gives the name of the terminal associated with FILE.
  33598.  
  33599. Return Value
  33600. ------------
  33601.  
  33602. Returns "con" if FILE is a device, else `NULL'.
  33603.  
  33604. Portability
  33605. -----------
  33606.  
  33607. not ANSI, POSIX
  33608.  
  33609. Example
  33610. -------
  33611.  
  33612.      char *tty = ttyname(0);
  33613.  
  33614. 
  33615. File: libc.info,  Node: tzset,  Next: tzsetwall,  Prev: ttyname,  Up: Alphabetical List
  33616.  
  33617. tzset
  33618. =====
  33619.  
  33620. Syntax
  33621. ------
  33622.  
  33623.      #include <time.h>
  33624.      
  33625.      extern char *tzname[2];
  33626.      void tzset(void);
  33627.  
  33628. Description
  33629. -----------
  33630.  
  33631. This function initializes the global variable `tzname' according to
  33632. environment variable `TZ'.  After the call, `tzname' holds the
  33633. specifications for the time zone for the standard and daylight-saving
  33634. times.
  33635.  
  33636. Return Value
  33637. ------------
  33638.  
  33639. None.
  33640.  
  33641. Portability
  33642. -----------
  33643.  
  33644. not ANSI, POSIX
  33645.  
  33646. 
  33647. File: libc.info,  Node: tzsetwall,  Next: uclock,  Prev: tzset,  Up: Alphabetical List
  33648.  
  33649. tzsetwall
  33650. =========
  33651.  
  33652. Syntax
  33653. ------
  33654.  
  33655.      #include <time.h>
  33656.      
  33657.      void tzsetwall(void);
  33658.  
  33659. Description
  33660. -----------
  33661.  
  33662. This function sets up the time conversion information used by
  33663. `localtime' (*note localtime::.) so that `localtime' returns the best
  33664. available approximation of the local wall clock time.
  33665.  
  33666. Return Value
  33667. ------------
  33668.  
  33669. None.
  33670.  
  33671. Portability
  33672. -----------
  33673.  
  33674. not ANSI, not POSIX
  33675.  
  33676. 
  33677. File: libc.info,  Node: uclock,  Next: umask,  Prev: tzsetwall,  Up: Alphabetical List
  33678.  
  33679. uclock
  33680. ======
  33681.  
  33682. Syntax
  33683. ------
  33684.  
  33685.      #include <time.h>
  33686.      
  33687.      uclock_t uclock(void);
  33688.  
  33689. Description
  33690. -----------
  33691.  
  33692. This function returns the number of uclock ticks since an arbitrary
  33693. time, actually, since the first call to `uclock', which itself returns
  33694. zero.  The number of tics per second is `UCLOCKS_PER_SEC' (declared in
  33695. the `time.h' header file.
  33696.  
  33697. `uclock' is provided for very high-resulution timing.  It is currently
  33698. accurate to better than 1 microsecond (actually about 840 nanoseconds).
  33699. You cannot time across two midnights with this implementation, giving
  33700. a maximum useful period of 48 hours and an effective limit of 24 hours.
  33701. Casting to a 32-bit integer limits its usefulness to about an hour
  33702. before 32 bits will wrap.
  33703.  
  33704. Note that `printf' will only print a value of type `uclock_t' correctly
  33705. if you use format specifiers for `long long' data, such as `%Ld' or
  33706. `%lld', because `uclock_t' is a 64-bit integer.  *Note printf::.
  33707.  
  33708. Also note that `uclock' reprograms the interval timer in your PC to act
  33709. as a rate generator rather than a square wave generator.  I've had no
  33710. problems running in this mode all the time, but if you notice strange
  33711. things happening with the clock (losing time) after using `uclock',
  33712. check to see if this is the cause of the problem.
  33713.  
  33714. Windows 3.X doesn't allow to reprogram the timer, so the values returned
  33715. by `uclock' there are incorrect.  DOS and Windows 9X don't have this
  33716. problem.
  33717.  
  33718. Return Value
  33719. ------------
  33720.  
  33721. The number of tics.
  33722.  
  33723. Portability
  33724. -----------
  33725.  
  33726. not ANSI, not POSIX
  33727.  
  33728. Example
  33729. -------
  33730.  
  33731.      printf("%Ld seconds have elapsed\n", (long long)(uclock()/UCLOCKS_PER_SEC));
  33732.  
  33733. 
  33734. File: libc.info,  Node: umask,  Next: uname,  Prev: uclock,  Up: Alphabetical List
  33735.  
  33736. umask
  33737. =====
  33738.  
  33739. Syntax
  33740. ------
  33741.  
  33742.      #include <sys/stat.h>
  33743.      
  33744.      mode_t umask(mode_t cmask);
  33745.  
  33746. Description
  33747. -----------
  33748.  
  33749. This function does nothing.  It exists to assist porting.
  33750.  
  33751. Portability
  33752. -----------
  33753.  
  33754. not ANSI, POSIX
  33755.  
  33756. 
  33757. File: libc.info,  Node: uname,  Next: ungetc,  Prev: umask,  Up: Alphabetical List
  33758.  
  33759. uname
  33760. =====
  33761.  
  33762. Syntax
  33763. ------
  33764.  
  33765.      #include <sys/utsname.h>
  33766.      
  33767.      #int uname(struct utsname *u);
  33768.  
  33769. Description
  33770. -----------
  33771.  
  33772. Fills in the structure with information about the system.
  33773.  
  33774.      struct utsname {
  33775.        char machine[9];
  33776.        char nodename[32];
  33777.        char release[9];
  33778.        char sysname[9];
  33779.        char version[9];
  33780.      };
  33781.  
  33782. `machine'
  33783.      "pc"
  33784.  
  33785. `nodename'
  33786.      The name of your PC (if networking is installed), else "pc".
  33787.  
  33788. `release'
  33789.      The minor release of dos.  For example, dos 1.23 would return "23"
  33790.      here.
  33791.  
  33792. `sysname'
  33793.      The flavor of the OS.
  33794.  
  33795. `version'
  33796.      The major release of dos.  For example, dos 1.23 would return "1"
  33797.      here.
  33798.  
  33799. Return Value
  33800. ------------
  33801.  
  33802. Zero on success, else nonzero.
  33803.  
  33804. Portability
  33805. -----------
  33806.  
  33807. not ANSI, POSIX
  33808.  
  33809. 
  33810. File: libc.info,  Node: ungetc,  Next: ungetch,  Prev: uname,  Up: Alphabetical List
  33811.  
  33812. ungetc
  33813. ======
  33814.  
  33815. Syntax
  33816. ------
  33817.  
  33818.      #include <stdio.h>
  33819.      
  33820.      int ungetc(int c, FILE *file);
  33821.  
  33822. Description
  33823. -----------
  33824.  
  33825. This function pushes C back into the FILE.  You can only push back one
  33826. character at a time.
  33827.  
  33828. Return Value
  33829. ------------
  33830.  
  33831. The pushed-back character, or `EOF' on error.
  33832.  
  33833. Portability
  33834. -----------
  33835.  
  33836. ANSI, POSIX
  33837.  
  33838. Example
  33839. -------
  33840.  
  33841.      int q;
  33842.      while (q = getc(stdin) != 'q');
  33843.      ungetc(q);
  33844.  
  33845. 
  33846. File: libc.info,  Node: ungetch,  Next: unlink,  Prev: ungetc,  Up: Alphabetical List
  33847.  
  33848. ungetch
  33849. =======
  33850.  
  33851. Syntax
  33852. ------
  33853.  
  33854.      #include <conio.h>
  33855.      
  33856.      int ungetch(int);
  33857.  
  33858. Description
  33859. -----------
  33860.  
  33861. Puts a character back, so that *Note getch:: will return it instead of
  33862. actually reading the console.
  33863.  
  33864. Return Value
  33865. ------------
  33866.  
  33867. The charater is returned.
  33868.  
  33869. Portability
  33870. -----------
  33871.  
  33872. not ANSI, not POSIX
  33873.  
  33874. 
  33875. File: libc.info,  Node: unlink,  Next: unlock,  Prev: ungetch,  Up: Alphabetical List
  33876.  
  33877. unlink
  33878. ======
  33879.  
  33880. Syntax
  33881. ------
  33882.  
  33883.      #include <unistd.h>
  33884.      
  33885.      int unlink(const char *file);
  33886.  
  33887. Description
  33888. -----------
  33889.  
  33890. This function removes a file from the file system.
  33891.  
  33892. Return Value
  33893. ------------
  33894.  
  33895. Zero on success, nonzero on failure.
  33896.  
  33897. Portability
  33898. -----------
  33899.  
  33900. not ANSI, POSIX
  33901.  
  33902. Example
  33903. -------
  33904.  
  33905.      unlink("data.txt");
  33906.  
  33907. 
  33908. File: libc.info,  Node: unlock,  Next: _use_lfn,  Prev: unlink,  Up: Alphabetical List
  33909.  
  33910. unlock
  33911. ======
  33912.  
  33913. Syntax
  33914. ------
  33915.  
  33916.      #include <io.h>
  33917.      
  33918.      int unlock(int fd, long offset, long length);
  33919.  
  33920. Description
  33921. -----------
  33922.  
  33923. Unlocks a region previously locked by `lock'.
  33924.  
  33925. *Note lock::.
  33926.  
  33927. Return Value
  33928. ------------
  33929.  
  33930. Zero if successful, nonzero if not.
  33931.  
  33932. Portability
  33933. -----------
  33934.  
  33935. not ANSI, not POSIX
  33936.  
  33937. 
  33938. File: libc.info,  Node: _use_lfn,  Next: usleep,  Prev: unlock,  Up: Alphabetical List
  33939.  
  33940. _use_lfn
  33941. ========
  33942.  
  33943. Syntax
  33944. ------
  33945.  
  33946.      #include <fcntl.h>
  33947.      
  33948.      char _use_lfn(const char *path);
  33949.  
  33950. Description
  33951. -----------
  33952.  
  33953. The `_use_lfn' function returns a nonzero value if the low level libc
  33954. routines will use the "Long File Name" (LFN) functions provided with
  33955. Windows 9x (and other advanced filesystems), when accessing files and
  33956. directories on the same filesystem as PATH.  PATH may be any legal
  33957. pathname; however, the function only needs the name of the root
  33958. directory on the particular drive in question.  If PATH is a `NULL'
  33959. pointer, the function assumes that all the filesystems support (or do
  33960. not support) LFN in the same manner, and returns the info pertinent to
  33961. the last filesystem that was queried; this usually makes the call
  33962. faster.  Note that on Windows 95 you don't need to distinguish between
  33963. different drives: they all support LFN API.  If PATH does not specify
  33964. the drive explicitly, the current drive is used.
  33965.  
  33966. The header `fcntl.h' defines a macro `_USE_LFN'; applications should
  33967. use this macro instead of calling `_use_lfn' directly.  That is so this
  33968. routine could be replaced with one which always returns 0 to disable
  33969. using long file names.  Calling `_USE_LFN' also makes the code more
  33970. portable to other operating systems, where the macro can be redefined
  33971. to whatever is appropriate for that environment (e.g., it should be a
  33972. constant 1 on Unix systems and constant 0 for environments that don't
  33973. support LFN API, like some other MSDOS compilers).  Currently,
  33974. `_USE_LFN' assumes that LFN API does *not* depend on a drive.
  33975.  
  33976. Long file names can also be disabled by setting the flag
  33977. `_CRT0_FLAG_NO_LFN' in `_crt0_startup_flags' for an image which should
  33978. not allow use of long file names.  Long names can be suppressed at
  33979. runtime on a global basis by setting the environment variable `LFN' to
  33980. `N', i.e. `SET LFN=N'.  This might be needed if a distribution expected
  33981. the truncation of long file names to 8.3 format to work.  For example,
  33982. if a C source routine included the file exception.h (9 letters) and the
  33983. file was unzipped as exceptio.h, then GCC would not find the file
  33984. unless you set `LFN=n'.  The environment variable can be set in the
  33985. `DJGPP.ENV' file to always disable LFN support on any system, or can be
  33986. set in the DOS environment for a short term (single project) basis.  If
  33987. you dual boot a system between Windows 95 and DOS, you probably should
  33988. set `LFN=n' in your `DJGPP.ENV' file, since long file names would not
  33989. be visible under DOS, and working with the short names under DOS will
  33990. damage the long names when returning to Windows 95.
  33991.  
  33992. Return Value
  33993. ------------
  33994.  
  33995. If LFN APIs are supported and should be used, it returns 1, else 0.
  33996.  
  33997. Note that if the `_CRT0_FLAG_NO_LFN' bit is set, or `LFN' is set to `N'
  33998. or `n' in the environment, both `_use_lfn' and `_USE_LFN' will always
  33999. return 0 without querying the filesystem.  You can reset the
  34000. `_CRT0_FLAG_NO_LFN' bit at runtime to force filesystem to be queried.
  34001.  
  34002. Portability
  34003. -----------
  34004.  
  34005. not ANSI, not POSIX
  34006.  
  34007. Example
  34008. -------
  34009.  
  34010.  
  34011.      #include <fcntl.h>
  34012.      #include <sys/stat.h>
  34013.      
  34014.        int fd = creat (_USE_LFN ? "MyCurrentJobFile.Text" : "currjob.txt",
  34015.                        S_IRUSR | S_IWUSR);
  34016.  
  34017. 
  34018. File: libc.info,  Node: usleep,  Next: utime,  Prev: _use_lfn,  Up: Alphabetical List
  34019.  
  34020. usleep
  34021. ======
  34022.  
  34023. Syntax
  34024. ------
  34025.  
  34026.      #include <unistd.h>
  34027.      
  34028.      unsigned usleep(unsigned usec);
  34029.  
  34030. Description
  34031. -----------
  34032.  
  34033. This function pauses the program for USEC microseconds.  Note that,
  34034. since `usleep' calls `clock' internally, and the latter has a 55-msec
  34035. granularity, any argument less than 55msec will result in a pause of
  34036. random length between 0 and 55 msec.  Any argument less than 11msec
  34037. (more precisely, less than 11264 microseconds), will always result in
  34038. zero-length pause (because `clock' multiplies the timer count by 5).
  34039. *Note clock::.
  34040.  
  34041. Return Value
  34042. ------------
  34043.  
  34044. The number of unslept microseconds (i.e. zero).
  34045.  
  34046. Portability
  34047. -----------
  34048.  
  34049. not ANSI, not POSIX
  34050.  
  34051. Example
  34052. -------
  34053.  
  34054.      usleep(500000);
  34055.  
  34056. 
  34057. File: libc.info,  Node: utime,  Next: utimes,  Prev: usleep,  Up: Alphabetical List
  34058.  
  34059. utime
  34060. =====
  34061.  
  34062. Syntax
  34063. ------
  34064.  
  34065.      #include <utime.h>
  34066.      
  34067.      int utime(const char *file, const struct utimbuf *time);
  34068.  
  34069. Description
  34070. -----------
  34071.  
  34072. This function sets the modification timestamp on the FILE.  The new
  34073. time is stored in this structure:
  34074.  
  34075.      struct utimbuf
  34076.      {
  34077.          time_t  actime;  /* access time (unused on FAT filesystems) */
  34078.          time_t  modtime; /* modification time */
  34079.      };
  34080.  
  34081. Note that, as under DOS a file only has a single timestamp, the
  34082. `actime' field of `struct utimbuf' is ignored by this function, and
  34083. only `modtime' field is used.  On filesystems which support long
  34084. filenames, both fields are used and both access and modification times
  34085. are set.
  34086.  
  34087. Return Value
  34088. ------------
  34089.  
  34090. Zero for success, nonzero for failure.
  34091.  
  34092. Portability
  34093. -----------
  34094.  
  34095. not ANSI, POSIX
  34096.  
  34097. Example
  34098. -------
  34099.  
  34100.      struct utimbuf t;
  34101.      t.modtime = time(0);
  34102.      utime("data.txt", &t);
  34103.  
  34104. 
  34105. File: libc.info,  Node: utimes,  Next: v2loadimage,  Prev: utime,  Up: Alphabetical List
  34106.  
  34107. utimes
  34108. ======
  34109.  
  34110. Syntax
  34111. ------
  34112.  
  34113.      #include <sys/time.h>
  34114.      
  34115.      int utimes(const char *file, struct timeval tvp[2]);
  34116.  
  34117. Description
  34118. -----------
  34119.  
  34120. This function sets the file access time as specified by `TVP[0]', and
  34121. its modification time as specified by `TVP[1]'.  `struct timeval' is
  34122. defined as follows:
  34123.  
  34124.      struct timeval {
  34125.        time_t tv_sec;
  34126.        long tv_usec;
  34127.      };
  34128.  
  34129. Note that DOS and Windows maintain the file times with 2-second
  34130. granularity.  Therefore, the `tv_usec' member of the argument is always
  34131. ignored, and the underlying filesystem truncates (or sometimes rounds)
  34132. the actual file time stamp to the multiple of 2 seconds.
  34133.  
  34134. On plain DOS, only one file time is maintained, which is arbitrarily
  34135. taken from `TVP[1].tv_sec'.  On Windows 9X, both times are used, but
  34136. note that most versions of Windows only use the date part and ignore
  34137. the time.
  34138.  
  34139. Due to limitations of DOS and Windows, you cannot set times of
  34140. directories.
  34141.  
  34142. Return Value
  34143. ------------
  34144.  
  34145. Zero on success, nonzero on failure.
  34146.  
  34147. Portability
  34148. -----------
  34149.  
  34150. not ANSI, not POSIX
  34151.  
  34152. Example
  34153. -------
  34154.  
  34155.      time_t now;
  34156.      struct timeval tvp[2];
  34157.      time(&now);
  34158.      tvp[1].tv_sec = now + 100;
  34159.      utimes("foo.dat", tvp);
  34160.  
  34161. 
  34162. File: libc.info,  Node: v2loadimage,  Next: varargs,  Prev: utimes,  Up: Alphabetical List
  34163.  
  34164. v2loadimage
  34165. ===========
  34166.  
  34167. Syntax
  34168. ------
  34169.  
  34170.      #include <debug/v2load.h>
  34171.      
  34172.      int v2loadimage (const char *program, const char *cmdline, jmp_buf load_state);
  34173.  
  34174. Description
  34175. -----------
  34176.  
  34177. This function loads an executable image of a DJGPP v2.x program and
  34178. prepares it for debugging.  PROGRAM should point to the file name of
  34179. the executable program.  `v2loadimage' does *not* search the `PATH' and
  34180. does *not* try any executable extensions, so PROGRAM should point to a
  34181. fully-qualified path, complete with the drive, directory, and file-name
  34182. extension; otherwise the call will fail.
  34183.  
  34184. CMDLINE should point to the command-line arguments to be passed to the
  34185. program.  The format of the command line should be exactly like the
  34186. command tail DOS passes to programs: the first byte gives the length of
  34187. the command tail, the tail itself begins with the second byte, and the
  34188. tail is terminated by a CR character (decimal code 13); the length byte
  34189. does not include the CR.  The command-line arguments should look as if
  34190. they were to be passed to the library function `system'.  In
  34191. particular, all special characters like wildcards and whitespace should
  34192. be quoted as if they were typed at the DOS prompt.
  34193.  
  34194. Note that currently, this function doesn't support command lines longer
  34195. than the DOS 126-character limit.
  34196.  
  34197. After the function loads the image and sets up the necessary memory
  34198. segments for it to be able to run, it sets LOAD_STATE so that it can be
  34199. used to `longjmp' to the debuggee's entry point.  This information is
  34200. typically used by `run_child' (*note run_child::.).
  34201.  
  34202. Return Value
  34203. ------------
  34204.  
  34205. Zero in case of success, non-zero otherwise.
  34206.  
  34207. Portability
  34208. -----------
  34209.  
  34210. not ANSI, not POSIX
  34211.  
  34212. Example
  34213. -------
  34214.  
  34215.       cmdline = (char *) alloca (strlen (args) + 4);
  34216.       cmdline[0] = strlen (args);
  34217.       strcpy (cmdline + 1, args);
  34218.       cmdline[strlen (args) + 1] = 13;
  34219.      
  34220.       if (v2loadimage (exec_file, cmdline, start_state))
  34221.        {
  34222.          printf ("Load failed for image %s\n", exec_file);
  34223.          exit (1);
  34224.        }
  34225.      
  34226.        edi_init (start_state);
  34227.  
  34228. 
  34229. File: libc.info,  Node: varargs,  Next: vfork,  Prev: v2loadimage,  Up: Alphabetical List
  34230.  
  34231. varargs
  34232. =======
  34233.  
  34234. Syntax
  34235. ------
  34236.  
  34237.  
  34238.      #include <stdarg.h>
  34239.      
  34240.      void va_start(va_list ap, LAST_REQUIRED_ARG);
  34241.      TYPE va_arg(va_list ap, TYPE);
  34242.      void va_end(va_list ap);
  34243.  
  34244. Description
  34245. -----------
  34246.  
  34247. Used to write functions taking a variable number of arguments.  Note
  34248. that these are actually macros, and not functions.  You must prototype
  34249. the function with `...' in its argument list.  Then, you do the
  34250. following:
  34251.  
  34252.    *  Create a variable of type `va_list'.
  34253.  
  34254.    *  Initialize it by calling `va_start' with it and the name of the
  34255.      last required (i.e. non-variable) argument.
  34256.  
  34257.    *  Retrieve the arguments by calling `va_arg' with the `va_list'
  34258.      variable and the type of the argument.  As another alternative,
  34259.      you can pass the `va_list' to another function, which may then use
  34260.      `va_arg' to get at the arguments.  `vprintf' is an example of this.
  34261.  
  34262.    *  Call `va_end' to destroy the `va_list'.
  34263.  
  34264. Be aware that your function must have some way to determine the number
  34265. and types of the arguments.  Usually this comes from one of the required
  34266. arguments.  Some popular ways are to pass a count, or to pass some
  34267. special value (like `NULL') at the end.
  34268.  
  34269. Also, the variable arguments will be promoted according to standard C
  34270. promotion rules.  Arguments of type `char' and `short' will be promoted
  34271. to `int', and you should retrieve them as such.  Those of type `float'
  34272. will be promoted to `double'.
  34273.  
  34274. Return Value
  34275. ------------
  34276.  
  34277. `va_arg' returns the argument it fetched, the other macros return
  34278. nothing.
  34279.  
  34280. Portability
  34281. -----------
  34282.  
  34283. ANSI, POSIX
  34284.  
  34285. Example
  34286. -------
  34287.  
  34288.  
  34289.      int find_the_sum(int count, ...)
  34290.      {
  34291.        va_list ap;
  34292.        int i;
  34293.        int total = 0;
  34294.      
  34295.        va_start(ap, count);
  34296.        for (i = 0; i < count; i++)
  34297.            total += va_arg(ap, int);
  34298.        va_end(ap);
  34299.        return total;
  34300.      }
  34301.      
  34302.      int other_function(void)
  34303.      {
  34304.        return find_the_sum(6, 1, 2, 3, 4, 5, 6);
  34305.      }
  34306.  
  34307. 
  34308. File: libc.info,  Node: vfork,  Next: vfprintf,  Prev: varargs,  Up: Alphabetical List
  34309.  
  34310. vfork
  34311. =====
  34312.  
  34313. Syntax
  34314. ------
  34315.  
  34316.      #include <unistd.h>
  34317.      
  34318.      pid_t vfork(void);
  34319.  
  34320. Description
  34321. -----------
  34322.  
  34323. This function always returns -1 and sets `errno' to ENOMEM, as MS-DOS
  34324. does not support multiple processes.  It exists only to assist in
  34325. porting Unix programs.
  34326.  
  34327. Portability
  34328. -----------
  34329.  
  34330. not ANSI, not POSIX
  34331.  
  34332. 
  34333. File: libc.info,  Node: vfprintf,  Next: vfscanf,  Prev: vfork,  Up: Alphabetical List
  34334.  
  34335. vfprintf
  34336. ========
  34337.  
  34338. Syntax
  34339. ------
  34340.  
  34341.      #include <stdio.h>
  34342.      #include <stdarg.h>
  34343.      
  34344.      int vfprintf(FILE *file, const char *format, va_list arguments);
  34345.  
  34346. Description
  34347. -----------
  34348.  
  34349. Sends formatted output from the ARGUMENTS to the FILE.  *Note printf::.
  34350.  
  34351. Return Value
  34352. ------------
  34353.  
  34354. The number of characters written.
  34355.  
  34356. Portability
  34357. -----------
  34358.  
  34359. ANSI, POSIX
  34360.  
  34361. Example
  34362. -------
  34363.  
  34364.      void my_errmsg(char *format, ...)
  34365.      {
  34366.        va_list arg;
  34367.      
  34368.        va_start(arg, format);
  34369.        fprintf(stderr, "my_errmsg: ");
  34370.        vfprintf(stderr, format, arg);
  34371.        va_end(arg);
  34372.      }
  34373.  
  34374. 
  34375. File: libc.info,  Node: vfscanf,  Next: vprintf,  Prev: vfprintf,  Up: Alphabetical List
  34376.  
  34377. vfscanf
  34378. =======
  34379.  
  34380. Syntax
  34381. ------
  34382.  
  34383.      #include <stdio.h>
  34384.      
  34385.      int vfscanf(FILE *file, const char *format, va_list arguments);
  34386.  
  34387. Description
  34388. -----------
  34389.  
  34390. This function scans formatted text from FILE and stores it in the
  34391. variables pointed to by the ARGUMENTS.  *Note scanf::.
  34392.  
  34393. Return Value
  34394. ------------
  34395.  
  34396. The number of items successfully scanned.
  34397.  
  34398. Portability
  34399. -----------
  34400.  
  34401. not ANSI, not POSIX
  34402.  
  34403. 
  34404. File: libc.info,  Node: vprintf,  Next: vscanf,  Prev: vfscanf,  Up: Alphabetical List
  34405.  
  34406. vprintf
  34407. =======
  34408.  
  34409. Syntax
  34410. ------
  34411.  
  34412.      #include <stdio.h>
  34413.      #include <stdarg.h>
  34414.      
  34415.      int vprintf(const char *format, va_list arguments);
  34416.  
  34417. Description
  34418. -----------
  34419.  
  34420. Sends formatted output from the ARGUMENTS to `stdout'.  *Note printf::.
  34421. *Note vfprintf::.
  34422.  
  34423. Return Value
  34424. ------------
  34425.  
  34426. The number of characters written.
  34427.  
  34428. Portability
  34429. -----------
  34430.  
  34431. ANSI, POSIX
  34432.  
  34433. 
  34434. File: libc.info,  Node: vscanf,  Next: vsprintf,  Prev: vprintf,  Up: Alphabetical List
  34435.  
  34436. vscanf
  34437. ======
  34438.  
  34439. Syntax
  34440. ------
  34441.  
  34442.      #include <stdio.h>
  34443.      
  34444.      int vscanf(const char *format, va_list arguments);
  34445.  
  34446. Description
  34447. -----------
  34448.  
  34449. This function scans formatted text from `stdin' and stores it in the
  34450. variables pointed to by the ARGUMENTS. *Note scanf::.  *Note vfscanf::.
  34451.  
  34452. Return Value
  34453. ------------
  34454.  
  34455. The number of items successfully scanned.
  34456.  
  34457. Portability
  34458. -----------
  34459.  
  34460. not ANSI, not POSIX
  34461.  
  34462. 
  34463. File: libc.info,  Node: vsprintf,  Next: vsscanf,  Prev: vscanf,  Up: Alphabetical List
  34464.  
  34465. vsprintf
  34466. ========
  34467.  
  34468. Syntax
  34469. ------
  34470.  
  34471.      #include <stdio.h>
  34472.      #include <stdarg.h>
  34473.      
  34474.      int vsprintf(char *buffer, const char *format, va_list arguments);
  34475.  
  34476. Description
  34477. -----------
  34478.  
  34479. Sends formatted output from the ARGUMENTS to the BUFFER.  *Note
  34480. printf::. *Note vfprintf::.
  34481.  
  34482. Return Value
  34483. ------------
  34484.  
  34485. The number of characters written.
  34486.  
  34487. Portability
  34488. -----------
  34489.  
  34490. ANSI, POSIX
  34491.  
  34492. 
  34493. File: libc.info,  Node: vsscanf,  Next: wait,  Prev: vsprintf,  Up: Alphabetical List
  34494.  
  34495. vsscanf
  34496. =======
  34497.  
  34498. Syntax
  34499. ------
  34500.  
  34501.      #include <stdio.h>
  34502.      
  34503.      int vsscanf(const char *string, const char *format, va_list arguments);
  34504.  
  34505. Description
  34506. -----------
  34507.  
  34508. This function scans formatted text from the STRING and stores it in the
  34509. variables pointed to by the ARGUMENTS. *Note scanf::.  *Note vfscanf::.
  34510.  
  34511. Return Value
  34512. ------------
  34513.  
  34514. The number of items successfully scanned.
  34515.  
  34516. Portability
  34517. -----------
  34518.  
  34519. not ANSI, not POSIX
  34520.  
  34521. 
  34522. File: libc.info,  Node: wait,  Next: waitpid,  Prev: vsscanf,  Up: Alphabetical List
  34523.  
  34524. wait
  34525. ====
  34526.  
  34527. Syntax
  34528. ------
  34529.  
  34530.      #include <sys/wait.h>
  34531.      
  34532.      pid_t pid = wait(int *status);
  34533.  
  34534. Description
  34535. -----------
  34536.  
  34537. This function causes its caller to delay its execution until a signal
  34538. is received or one of its child processes terminates.  If any child has
  34539. terminated, return is immediate, returning the process ID and its exit
  34540. status, if that's available.  If no children processes were called since
  34541. the last call, then -1 is returned and `errno' is set.
  34542.  
  34543. Return Value
  34544. ------------
  34545.  
  34546. If successful, this function returns the exit status of the child.  If
  34547. there is an error, these functions return -1 and set `errno' to
  34548. indicate the error type.
  34549.  
  34550. Bugs
  34551. ----
  34552.  
  34553. Currently, this function always fails.
  34554.  
  34555. Portability
  34556. -----------
  34557.  
  34558. not ANSI, POSIX
  34559.  
  34560. 
  34561. File: libc.info,  Node: waitpid,  Next: wcstombs,  Prev: wait,  Up: Alphabetical List
  34562.  
  34563. waitpid
  34564. =======
  34565.  
  34566. Syntax
  34567. ------
  34568.  
  34569.      #include <sys/wait.h>
  34570.      
  34571.      pid_t pid = waitpid((pid_t pid, int *status, int options);
  34572.  
  34573. Description
  34574. -----------
  34575.  
  34576. Currently, this function always fails. A -1 is returned and `errno' is
  34577. set to indicate there are no children.
  34578.  
  34579. Return Value
  34580. ------------
  34581.  
  34582. If successful, this function returns the exit status of the child.  If
  34583. there is an error, these functions return -1 and set `errno' to
  34584. indicate the error type.
  34585.  
  34586. Bugs
  34587. ----
  34588.  
  34589. Currently, this function always fails.
  34590.  
  34591. Portability
  34592. -----------
  34593.  
  34594. not ANSI, POSIX
  34595.  
  34596. 
  34597. File: libc.info,  Node: wcstombs,  Next: wctomb,  Prev: waitpid,  Up: Alphabetical List
  34598.  
  34599. wcstombs
  34600. ========
  34601.  
  34602. Syntax
  34603. ------
  34604.  
  34605.      #include <stdlib.h>
  34606.      
  34607.      size_t wcstombs(char *s, const wchar_t *wcs, size_t n);
  34608.  
  34609. Description
  34610. -----------
  34611.  
  34612. Converts a wide character string to a multibyte string.  At most N
  34613. characters are stored.
  34614.  
  34615. Return Value
  34616. ------------
  34617.  
  34618. The number of characters stored.
  34619.  
  34620. Portability
  34621. -----------
  34622.  
  34623. ANSI, POSIX
  34624.  
  34625. Example
  34626. -------
  34627.  
  34628.      int len = wcstombs(buf, wstring, sizeof(buf));
  34629.  
  34630. 
  34631. File: libc.info,  Node: wctomb,  Next: wherex,  Prev: wcstombs,  Up: Alphabetical List
  34632.  
  34633. wctomb
  34634. ======
  34635.  
  34636. Syntax
  34637. ------
  34638.  
  34639.      #include <stdlib.h>
  34640.      
  34641.      int wctomb(char *s, wchar_t wchar);
  34642.  
  34643. Description
  34644. -----------
  34645.  
  34646. Convert a wide character to a multibyte character.  The string S must
  34647. be at least `MB_LEN_MAX' bytes long.
  34648.  
  34649. Return Value
  34650. ------------
  34651.  
  34652. The number of characters stored.
  34653.  
  34654. Portability
  34655. -----------
  34656.  
  34657. ANSI, POSIX
  34658.  
  34659. Example
  34660. -------
  34661.  
  34662.      char s[MB_LEN_MAX];
  34663.      int mlen = wctomb(s, wc);
  34664.  
  34665. 
  34666. File: libc.info,  Node: wherex,  Next: wherey,  Prev: wctomb,  Up: Alphabetical List
  34667.  
  34668. wherex
  34669. ======
  34670.  
  34671. Syntax
  34672. ------
  34673.  
  34674.      #include <conio.h>
  34675.      
  34676.      int wherex(void);
  34677.  
  34678. Return Value
  34679. ------------
  34680.  
  34681. The column the cursor is on.  The leftmost column is 1.
  34682.  
  34683. Portability
  34684. -----------
  34685.  
  34686. not ANSI, not POSIX
  34687.  
  34688. 
  34689. File: libc.info,  Node: wherey,  Next: wild,  Prev: wherex,  Up: Alphabetical List
  34690.  
  34691. wherey
  34692. ======
  34693.  
  34694. Syntax
  34695. ------
  34696.  
  34697.      #include <conio.h>
  34698.      
  34699.      int     wherey(void);
  34700.  
  34701. Return Value
  34702. ------------
  34703.  
  34704. The row the cursor is on.  The topmost row is 1.
  34705.  
  34706. Portability
  34707. -----------
  34708.  
  34709. not ANSI, not POSIX
  34710.  
  34711. 
  34712. File: libc.info,  Node: wild,  Next: window,  Prev: wherey,  Up: Alphabetical List
  34713.  
  34714. wild
  34715. ====
  34716.  
  34717. Syntax
  34718. ------
  34719.  
  34720.      #include <debug/wild.h>
  34721.      
  34722.      int wild (char *pattern, char *string);
  34723.  
  34724. Description
  34725. -----------
  34726.  
  34727. This function matches a string pointed to by STRING against a pattern
  34728. pointed to by PATTERN.  PATTERN may include wildcard characters `?' and
  34729. `*', meaning, respectively, any single character and any string of
  34730. characters.  The function returns non-zero if the string matches the
  34731. pattern, zero otherwise.
  34732.  
  34733. This functions is meant to be used for simple matching of patterns, such
  34734. as if a debugger needs to allow specification of symbols using
  34735. wildcards.
  34736.  
  34737. Return Value
  34738. ------------
  34739.  
  34740. The function returns non-zero if the string matches the pattern, zero
  34741. otherwise.
  34742.  
  34743. Portability
  34744. -----------
  34745.  
  34746. not ANSI, not POSIX
  34747.  
  34748. 
  34749. File: libc.info,  Node: window,  Next: write,  Prev: wild,  Up: Alphabetical List
  34750.  
  34751. window
  34752. ======
  34753.  
  34754. Syntax
  34755. ------
  34756.  
  34757.      #include <conio.h>
  34758.      
  34759.      void    window(int _left, int _top, int _right, int _bottom);
  34760.  
  34761. Description
  34762. -----------
  34763.  
  34764. Specifies the window on the screen to be used for future output
  34765. requests.  The upper left corner of the physical screen is (1,1).
  34766.  
  34767. Portability
  34768. -----------
  34769.  
  34770. not ANSI, not POSIX
  34771.  
  34772. 
  34773. File: libc.info,  Node: write,  Next: _write,  Prev: window,  Up: Alphabetical List
  34774.  
  34775. write
  34776. =====
  34777.  
  34778. Syntax
  34779. ------
  34780.  
  34781.      #include <unistd.h>
  34782.      
  34783.      int write(int file, const void *buffer, size_t count);
  34784.  
  34785. Description
  34786. -----------
  34787.  
  34788. This function writes COUNT bytes from BUFFER to FILE.  It returns the
  34789. number of bytes actually written.  It will return zero or a number less
  34790. than COUNT if the disk is full, and may return less than COUNT even
  34791. under valid conditions.
  34792.  
  34793. Note that if FILE is a text file, `write' may write more bytes than it
  34794. reports.
  34795.  
  34796. If COUNT is zero, the function does nothing and returns zero.  Use
  34797. `_write' if you want to actually ask dos to write zero bytes.
  34798.  
  34799. The precise behavior of `write' when the target filesystem is full are
  34800. somewhat troublesome, because DOS doesn't fail the underlying system
  34801. call.  If your application needs to rely on `errno' being set to
  34802. `ENOSPC' in such cases, you need to invoke `write' as shown in the
  34803. example below.  In a nutshell, the trick is to call `write' one more
  34804. time after it returns a value smaller than the COUNT parameter; then it
  34805. will *always* set `errno' if the disk is full.
  34806.  
  34807. Return Value
  34808. ------------
  34809.  
  34810. The number of bytes written, zero at EOF, or -1 on error.
  34811.  
  34812. Portability
  34813. -----------
  34814.  
  34815. not ANSI, POSIX
  34816.  
  34817. Example
  34818. -------
  34819.  
  34820. This example shows how to call `write' in a way which ensures that
  34821. `errno' will be set to `ENOSPC' if the target filesystem is or becomes
  34822. full:
  34823.  
  34824.        char *buf_ptr;    /* the buffer to write */
  34825.        size_t buf_len;   /* the number of bytes to write */
  34826.        int desc;         /* the file descriptor to write to */
  34827.      
  34828.        while (buf_len > 0)
  34829.        {
  34830.          int written = write (desc, buf_ptr, buf_len);
  34831.          if (written <= 0)
  34832.            break;
  34833.      
  34834.          buf_ptr += written;
  34835.          buf_len -= written;
  34836.        }
  34837.  
  34838. 
  34839. File: libc.info,  Node: _write,  Next: write_child,  Prev: write,  Up: Alphabetical List
  34840.  
  34841. _write
  34842. ======
  34843.  
  34844. Syntax
  34845. ------
  34846.  
  34847.      #include <io.h>
  34848.      
  34849.      ssize_t _write(int fildes, void *buf, size_t nbyte);
  34850.  
  34851. Description
  34852. -----------
  34853.  
  34854. This is a direct connection to the MS-DOS write function call, int
  34855. 0x21, %ah = 0x40.  No conversion is done on the data; it is written as
  34856. raw binary data.  This function can be hooked by the File-system
  34857. extensions, see *Note File System Extensions::.  If you don't want this,
  34858. you should use `_dos_write' instead, see *Note _dos_write::.
  34859.  
  34860. Return Value
  34861. ------------
  34862.  
  34863. The number of bytes written, or -1 (and `errno' set) in case of failure.
  34864.  
  34865. Note that DOS doesn't return an error indication when the target disk is
  34866. full; therefore if the disk fills up while the data is written,
  34867. `_write' does *not* return -1, it returns the number of bytes it
  34868. succeeded to write.  If you need to detect the disk full condition
  34869. reliably, call `_write' again to try to write the rest of the data.
  34870. This will cause DOS to return zero as the number of written bytes, and
  34871. *then* `_write' will return -1 and set `errno' to `ENOSPC'.  The
  34872. example below shows one way of doing this.
  34873.  
  34874. Portability
  34875. -----------
  34876.  
  34877. not ANSI, not POSIX
  34878.  
  34879. Example
  34880. -------
  34881.  
  34882. This example shows how to call `_write' in a way which ensures that
  34883. `errno' will be set to `ENOSPC' if the target filesystem is or becomes
  34884. full:
  34885.  
  34886.        char *buf_ptr;    /* the buffer to write */
  34887.        size_t buf_len;   /* the number of bytes to write */
  34888.        int desc;         /* the file descriptor to write to */
  34889.      
  34890.        while (buf_len > 0)
  34891.        {
  34892.          int written = _write (desc, buf_ptr, buf_len);
  34893.          if (written <= 0)
  34894.            break;
  34895.      
  34896.          buf_ptr += written;
  34897.          buf_len -= written;
  34898.        }
  34899.  
  34900. 
  34901. File: libc.info,  Node: write_child,  Next: write_sel_addr,  Prev: _write,  Up: Alphabetical List
  34902.  
  34903. write_child
  34904. ===========
  34905.  
  34906. Syntax
  34907. ------
  34908.  
  34909.      #include <debug/dbgcom.h>
  34910.      
  34911.      void write_child (unsigned child_addr, void *buf, unsigned len);
  34912.  
  34913. Description
  34914. -----------
  34915.  
  34916. This function transfers LEN bytes from the buffer pointed to by BUF in
  34917. the debugger's data segment to the memory of the debugged process
  34918. starting at the address CHILD_ADDR.  It is used primarily to insert a
  34919. breakpoint instruction into the debugged process (to trigger a trap
  34920. when the debuggee's code gets to that point).  The companion function
  34921. `read_child' (*note read_child::.) is usually called before
  34922. `write_child' to save the original code overwritten by the breakpoint
  34923. instruction.
  34924.  
  34925. Return Value
  34926. ------------
  34927.  
  34928. The function return zero if it has successfully transferred the data,
  34929. non-zero otherwise (e.g., if the address in CHILD_ADDR is outside the
  34930. limits of the debuggee's code segment.
  34931.  
  34932. Portability
  34933. -----------
  34934.  
  34935. not ANSI, not POSIX
  34936.  
  34937. 
  34938. File: libc.info,  Node: write_sel_addr,  Next: xfree,  Prev: write_child,  Up: Alphabetical List
  34939.  
  34940. write_sel_addr
  34941. ==============
  34942.  
  34943. Syntax
  34944. ------
  34945.  
  34946.      #include <debug/dbgcom.h>
  34947.      
  34948.      void write_sel_addr (unsigned sel, unsigned offset, void *buf, unsigned len);
  34949.  
  34950. Description
  34951. -----------
  34952.  
  34953. This function transfers LEN bytes from the buffer pointed to by BUF in
  34954. the data segment whose selector is SEL, at offset OFFSET.  The
  34955. companion function `read_sel_addr' (*note read_sel_addr::.) is usually
  34956. called before `write_sel_addr' to save the original contents, if needed.
  34957.  
  34958. Return Value
  34959. ------------
  34960.  
  34961. The function return zero if it has successfully transferred the data,
  34962. non-zero otherwise (e.g., if the address in OFFSET is outside the
  34963. limits of the SELs segment).
  34964.  
  34965. Portability
  34966. -----------
  34967.  
  34968. not ANSI, not POSIX
  34969.  
  34970. 
  34971. File: libc.info,  Node: xfree,  Next: xmalloc,  Prev: write_sel_addr,  Up: Alphabetical List
  34972.  
  34973. xfree
  34974. =====
  34975.  
  34976. Syntax
  34977. ------
  34978.  
  34979.      #include <stdlib.h>
  34980.      
  34981.      void xfree(void *ptr);
  34982.  
  34983. Description
  34984. -----------
  34985.  
  34986. Frees memory allocated by `xmalloc' (*note xmalloc::.).  This function
  34987. guarantees that a NULL pointer is handled gracefully.
  34988.  
  34989. Note that, currently, the header `stdlib.h' does *not* declare a
  34990. prototype for `xfree', because many programs declare its prototype in
  34991. different and conflicting ways.  If you use `xfree' in your own code,
  34992. you might need to provide your own prototype explicitly.
  34993.  
  34994. Portability
  34995. -----------
  34996.  
  34997. not ANSI, not POSIX
  34998.  
  34999. Example
  35000. -------
  35001.  
  35002.      void *f = xmalloc(100);
  35003.      xfree(f);
  35004.  
  35005. 
  35006. File: libc.info,  Node: xmalloc,  Next: xrealloc,  Prev: xfree,  Up: Alphabetical List
  35007.  
  35008. xmalloc
  35009. =======
  35010.  
  35011. Syntax
  35012. ------
  35013.  
  35014.      #include <stdlib.h>
  35015.      
  35016.      void *xmalloc(size_t size);
  35017.  
  35018. Description
  35019. -----------
  35020.  
  35021. This function is just like `malloc' (*note malloc::.), except that if
  35022. there is no more memory, it prints an error message and exits.
  35023.  
  35024. Note that, currently, the header `stdlib.h' does *not* declare a
  35025. prototype for `xmalloc', because many programs declare its prototype in
  35026. different and conflicting ways.  If you use `xmalloc' in your own code,
  35027. you might need to provide your own prototype explicitly.
  35028.  
  35029. Return Value
  35030. ------------
  35031.  
  35032. A pointer to the newly allocated memory.
  35033.  
  35034. Portability
  35035. -----------
  35036.  
  35037. not ANSI, not POSIX
  35038.  
  35039. Example
  35040. -------
  35041.  
  35042.      char *f = xmalloc(100);
  35043.  
  35044. 
  35045. File: libc.info,  Node: xrealloc,  Prev: xmalloc,  Up: Alphabetical List
  35046.  
  35047. xrealloc
  35048. ========
  35049.  
  35050. Syntax
  35051. ------
  35052.  
  35053.      #include <stdlib.h>
  35054.      
  35055.      void *xrealloc(void *ptr, size_t size);
  35056.  
  35057. Description
  35058. -----------
  35059.  
  35060. This function is just like `realloc' (*note realloc::.), except that if
  35061. there is no more memory, it prints an error message and exits.  It can
  35062. also properly handle PTR being `NULL'.
  35063.  
  35064. Note that, currently, the header `stdlib.h' does *not* declare a
  35065. prototype for `xrealloc', because many programs declare its prototype
  35066. in different and conflicting ways.  If you use `xrealloc' in your own
  35067. code, you might need to provide your own prototype explicitly.
  35068.  
  35069. Return Value
  35070. ------------
  35071.  
  35072. A pointer to a possibly new block.
  35073.  
  35074. Portability
  35075. -----------
  35076.  
  35077. not ANSI, not POSIX
  35078.  
  35079. Example
  35080. -------
  35081.  
  35082.      char *buf;
  35083.      buf = (char *)xrealloc(buf, new_size);
  35084.  
  35085. 
  35086. File: libc.info,  Node: Unimplemented,  Next: Master Index,  Prev: Alphabetical List,  Up: Top
  35087.  
  35088. Unimplemented Functions
  35089. ***********************
  35090.  
  35091. The DJGPP standard C library is ANSI- and POSIX-compliant, and provides
  35092. many additional functions for compatibility with Unix/Linux systems.
  35093. However, some of the functions needed for this compatibility are very
  35094. hard or impossible to implement using DOS facilities.
  35095.  
  35096. Therefore, a small number of library functions are really just stubs:
  35097. they are provided because POSIX requires them to be present in a
  35098. compliant library, or because they are widely available on Unix systems,
  35099. but they either always fail, or handle only the trivial cases and fail
  35100. for all the others.  An example of the former behavior is the function
  35101. `fork': it always returns a failure indication; an example of the
  35102. latter behavior is the function `mknode': it handles the cases of
  35103. regular files and existing character devices, but fails for all other
  35104. file types.
  35105.  
  35106. This chapter lists all such functions.  This list is here for the
  35107. benefit of programmers who write portable programs or port Unix packages
  35108. to DJGPP.
  35109.  
  35110. Each function below is labeled as either "always fails" or "trivial",
  35111. depending on which of the two classes described above it belongs to.
  35112. An additional class, labeled "no-op", includes functions which pretend
  35113. to succeed, but have no real effect, since the underlying functionality
  35114. is either always available or always ignored.
  35115.  
  35116. * Menu:
  35117.  
  35118. * addmntent::                Always fails.
  35119. * cfgetispeed::              No-op.
  35120. * cfgetospeed::              No-op.
  35121. * cfsetispeed::              No-op.
  35122. * cfsetospeed::              No-op.
  35123. * chown::                    Trivial.
  35124. * fcntl::                    Always fails for all operations except
  35125.                              `F_DUPFD' and `F_GETFD'.
  35126. * fork::                     Always fails.
  35127. * getgrgid::                 Trivial.
  35128. * getgrnam::                 Trivial.
  35129. * getgroups::                Trivial.
  35130. * getpwnam::                 Trivial.
  35131. * getpwuid::                 Trivial.
  35132. * mkfifo::                   Always fails.
  35133. * mknod::                    Trivial.
  35134. * nice::                     No-op.
  35135. * pipe::                     Always fails.
  35136. * setgid::                   Trivial.
  35137. * setpgid::                  Trivial.
  35138. * setsid::                   Trivial.
  35139. * setuid::                   Trivial.
  35140. * tcdrain::                  No-op.
  35141. * tcsendbreak::              No-op.
  35142. * tcsetpgrp::                Trivial.
  35143. * umask::                    Trivial.
  35144. * vfork::                    Always fails.
  35145. * wait::                     Always fails.
  35146. * waitpid::                  Always fails.
  35147.  
  35148. 
  35149. File: libc.info,  Node: Master Index,  Prev: Unimplemented,  Up: Top
  35150.  
  35151. * Menu:
  35152. *Note Alphabetical List::.
  35153.  
  35154.  
  35155. 
  35156. Tag Table:
  35157. Node: Top177
  35158. Node: Introduction606
  35159. Node: Functional Categories1921
  35160. Node: bios functions2661
  35161. Node: conio functions3050
  35162. Node: cpu functions3902
  35163. Node: ctype functions4446
  35164. Node: debugging functions4791
  35165. Node: dos functions5359
  35166. Node: dpmi functions6091
  35167. Node: environment functions10043
  35168. Node: file system functions10261
  35169. Node: go32 functions11297
  35170. Node: io functions11705
  35171. Node: locale functions12266
  35172. Node: math functions12538
  35173. Node: memory functions13098
  35174. Node: misc functions13882
  35175. Node: mono functions14285
  35176. Node: posix functions14491
  35177. Node: process functions14709
  35178. Node: random number functions15095
  35179. Node: shell functions15363
  35180. Node: signal functions15556
  35181. Node: sound functions16008
  35182. Node: startup functions16195
  35183. Node: stdio functions16484
  35184. Node: string functions17405
  35185. Node: termios functions18091
  35186. Node: time functions18505
  35187. Node: unix functions18929
  35188. Node: Alphabetical List19593
  35189. Node: _808732094
  35190. Node: abort32666
  35191. Node: abs33422
  35192. Node: access33759
  35193. Node: acos34699
  35194. Node: acosh35253
  35195. Node: addmntent35713
  35196. Node: alarm36185
  35197. Node: alloca37351
  35198. Node: asctime37913
  35199. Node: asin39381
  35200. Node: asinh39860
  35201. Node: assert40437
  35202. Node: atan41483
  35203. Node: atan242087
  35204. Node: atanh43196
  35205. Node: atexit43811
  35206. Node: atof44577
  35207. Node: atoi45185
  35208. Node: atol45779
  35209. Node: _atold46377
  35210. Node: basename47024
  35211. Node: bcmp48201
  35212. Node: bcopy48853
  35213. Node: bdos49375
  35214. Node: bdosptr50198
  35215. Node: _bios_disk51379
  35216. Node: _bios_equiplist56228
  35217. Node: _bios_keybrd57489
  35218. Node: _bios_memsize60129
  35219. Node: _bios_printer60641
  35220. Node: _bios_serialcom62004
  35221. Node: _bios_timeofday64919
  35222. Node: bioscom65946
  35223. Node: biosdisk68648
  35224. Node: biosequip70757
  35225. Node: bioskey72139
  35226. Node: biosmemory75175
  35227. Node: biosprint75797
  35228. Node: biostime76627
  35229. Node: blinkvideo77157
  35230. Node: brk78155
  35231. Node: bsearch78840
  35232. Node: bzero80133
  35233. Node: calloc80539
  35234. Node: cbrt81304
  35235. Node: ceil81869
  35236. Node: cfgetispeed82261
  35237. Node: cfgetospeed82943
  35238. Node: cfmakeraw83629
  35239. Node: cfree84141
  35240. Node: cfsetispeed84598
  35241. Node: cfsetospeed85274
  35242. Node: cfsetspeed85956
  35243. Node: cgets86511
  35244. Node: chdir87147
  35245. Node: _check_v2_prog87823
  35246. Node: chmod91547
  35247. Node: _chmod92269
  35248. Node: chown93586
  35249. Node: chsize94026
  35250. Node: cleanup_client94394
  35251. Node: _clear8794962
  35252. Node: clearerr95342
  35253. Node: clock95742
  35254. Node: close96302
  35255. Node: _close96758
  35256. Node: closedir97284
  35257. Node: clreol97680
  35258. Node: clrscr97983
  35259. Node: _conio_kbhit98259
  35260. Node: _control8798836
  35261. Node: cos103084
  35262. Node: cosh104301
  35263. Node: cprintf104958
  35264. Node: cputs105495
  35265. Node: creat105859
  35266. Node: _creat106634
  35267. Node: _creatnew107454
  35268. Node: crlf2nl110386
  35269. Node: __crt0_glob_function110820
  35270. Node: __crt0_load_environment_file111647
  35271. Node: __crt0_setup_arguments112421
  35272. Node: _crt0_startup_flags113427
  35273. Node: cscanf119031
  35274. Node: ctermid119556
  35275. Node: ctime120043
  35276. Node: delay120509
  35277. Node: delline121234
  35278. Node: _detect_80387121556
  35279. Node: difftime122139
  35280. Node: dirname122678
  35281. Node: disable123762
  35282. Node: div124355
  35283. Node: __djgpp_exception_toggle125113
  35284. Node: __djgpp_map_physical_memory126068
  35285. Node: __djgpp_memory_handle127711
  35286. Node: __djgpp_memory_handle_list128398
  35287. Node: __djgpp_nearptr_disable129027
  35288. Node: __djgpp_nearptr_enable129480
  35289. Node: __djgpp_set_ctrl_c131135
  35290. Node: __djgpp_set_page_attributes133381
  35291. Node: __djgpp_set_sigint_key134734
  35292. Node: __djgpp_set_sigquit_key136988
  35293. Node: __djgpp_share_flags139213
  35294. Node: __djgpp_traceback_exit140856
  35295. Node: _djstat_describe_lossage141694
  35296. Node: _djstat_fail_bits143922
  35297. Node: _djstat_flags147512
  35298. Node: _doprnt150688
  35299. Node: _dos_close151384
  35300. Node: _dos_commit152102
  35301. Node: _dos_creat152736
  35302. Node: _dos_creatnew154219
  35303. Node: _dos_findfirst155715
  35304. Node: _dos_findnext157961
  35305. Node: _dos_getdate158796
  35306. Node: _dos_getdiskfree159606
  35307. Node: _dos_getdrive160918
  35308. Node: _dos_getfileattr161527
  35309. Node: _dos_getftime163229
  35310. Node: _dos_gettime165482
  35311. Node: _dos_lock166241
  35312. Node: _dos_open166667
  35313. Node: _dos_read168564
  35314. Node: _dos_setdate170009
  35315. Node: _dos_setdrive171046
  35316. Node: _dos_setfileattr171806
  35317. Node: _dos_setftime173064
  35318. Node: _dos_settime174839
  35319. Node: _dos_unlock175796
  35320. Node: _dos_write176232
  35321. Node: _doscan177718
  35322. Node: _doserrno178470
  35323. Node: dosexterr179127
  35324. Node: dosmemget184806
  35325. Node: dosmemgetb185728
  35326. Node: dosmemgetl186695
  35327. Node: dosmemgetw187681
  35328. Node: dosmemput188663
  35329. Node: dosmemputb189552
  35330. Node: dosmemputl190493
  35331. Node: dosmemputw191444
  35332. Node: DPMI Overview192400
  35333. Node: DPMI Specification197453
  35334. Node: __dpmi_allocate_dos_memory197793
  35335. Node: __dpmi_allocate_ldt_descriptors198776
  35336. Node: __dpmi_allocate_linear_memory199596
  35337. Node: __dpmi_allocate_memory200502
  35338. Node: __dpmi_allocate_real_mode_callback201176
  35339. Node: __dpmi_allocate_shared_memory202139
  35340. Node: __dpmi_allocate_specific_ldt_descriptor203431
  35341. Node: __dpmi_clear_debug_watchpoint204130
  35342. Node: __dpmi_create_alias_descriptor204790
  35343. Node: __dpmi_discard_page_contents205485
  35344. Node: __dpmi_free_dos_memory206219
  35345. Node: __dpmi_free_ldt_descriptor206938
  35346. Node: __dpmi_free_memory207662
  35347. Node: __dpmi_free_physical_address_mapping208283
  35348. Node: __dpmi_free_real_mode_callback209100
  35349. Node: __dpmi_free_serialization_on_shared_memory209797
  35350. Node: __dpmi_free_shared_memory210925
  35351. Node: __dpmi_get_and_disable_virtual_interrupt_state211737
  35352. Node: __dpmi_get_and_enable_virtual_interrupt_state212490
  35353. Node: __dpmi_get_and_set_virtual_interrupt_state213256
  35354. Node: __dpmi_get_capabilities214110
  35355. Node: __dpmi_get_coprocessor_status215322
  35356. Node: __dpmi_get_descriptor216488
  35357. Node: __dpmi_get_descriptor_access_rights222128
  35358. Node: __dpmi_get_extended_exception_handler_vector_pm222953
  35359. Node: __dpmi_get_extended_exception_handler_vector_rm223860
  35360. Node: __dpmi_get_free_memory_information224760
  35361. Node: __dpmi_get_memory_block_size_and_base225549
  35362. Node: __dpmi_get_memory_information226316
  35363. Node: __dpmi_get_multiple_descriptors228622
  35364. Node: __dpmi_get_page_attributes229696
  35365. Node: __dpmi_get_page_size231151
  35366. Node: __dpmi_get_processor_exception_handler_vector231788
  35367. Node: __dpmi_get_protected_mode_interrupt_vector232698
  35368. Node: __dpmi_get_raw_mode_switch_addr233539
  35369. Node: __dpmi_get_real_mode_interrupt_vector234237
  35370. Node: __dpmi_get_segment_base_address235140
  35371. Node: __dpmi_get_segment_limit235963
  35372. Node: __dpmi_get_selector_increment_value236578
  35373. Node: __dpmi_get_state_of_debug_watchpoint237285
  35374. Node: __dpmi_get_state_save_restore_addr238061
  35375. Node: __dpmi_get_vendor_specific_api_entry_point238783
  35376. Node: __dpmi_get_version239530
  35377. Node: __dpmi_get_virtual_interrupt_state240447
  35378. Node: __dpmi_install_resident_service_provider_callback241119
  35379. Node: __dpmi_int242710
  35380. Node: __dpmi_lock_linear_region243764
  35381. Node: __dpmi_map_conventional_memory_in_memory_block244491
  35382. Node: __dpmi_map_device_in_memory_block245450
  35383. Node: __dpmi_mark_page_as_demand_paging_candidate246399
  35384. Node: __dpmi_mark_real_mode_region_as_pageable247194
  35385. Node: __dpmi_physical_address_mapping247991
  35386. Node: __dpmi_relock_real_mode_region248805
  35387. Node: __dpmi_reset_debug_watchpoint249565
  35388. Node: __dpmi_resize_dos_memory250233
  35389. Node: __dpmi_resize_linear_memory251033
  35390. Node: __dpmi_resize_memory251903
  35391. Node: __dpmi_segment_to_descriptor252707
  35392. Node: __dpmi_serialize_on_shared_memory253589
  35393. Node: __dpmi_set_coprocessor_emulation254975
  35394. Node: __dpmi_set_debug_watchpoint256214
  35395. Node: __dpmi_set_descriptor256980
  35396. Node: __dpmi_set_descriptor_access_rights257848
  35397. Node: __dpmi_set_extended_exception_handler_vector_pm259297
  35398. Node: __dpmi_set_extended_exception_handler_vector_rm260205
  35399. Node: __dpmi_set_multiple_descriptors261104
  35400. Node: __dpmi_set_page_attributes262066
  35401. Node: __dpmi_set_processor_exception_handler_vector263355
  35402. Node: __dpmi_set_protected_mode_interrupt_vector264186
  35403. Node: __dpmi_set_real_mode_interrupt_vector265217
  35404. Node: __dpmi_set_segment_base_address266071
  35405. Node: __dpmi_set_segment_limit266782
  35406. Node: __dpmi_simulate_real_mode_interrupt267737
  35407. Node: __dpmi_simulate_real_mode_procedure_iret268621
  35408. Node: __dpmi_simulate_real_mode_procedure_retf269479
  35409. Node: __dpmi_simulate_real_mode_procedure_retf_stack270377
  35410. Node: __dpmi_terminate_and_stay_resident271757
  35411. Node: __dpmi_unlock_linear_region273155
  35412. Node: __dpmi_yield273831
  35413. Node: dup274759
  35414. Node: dup2275222
  35415. Node: _dxe_load275805
  35416. Node: ecvt276614
  35417. Node: ecvtbuf277224
  35418. Node: edi_init278796
  35419. Node: enable279692
  35420. Node: endgrent280288
  35421. Node: endmntent280701
  35422. Node: endpwent281119
  35423. Node: errno281490
  35424. Node: exec*288328
  35425. Node: __exit289443
  35426. Node: _exit290105
  35427. Node: exit290816
  35428. Node: exp291374
  35429. Node: exp10292219
  35430. Node: exp2292985
  35431. Node: expm1293749
  35432. Node: fabs294691
  35433. Node: _far*295176
  35434. Node: fclose297833
  35435. Node: fcntl298264
  35436. Node: fcvt302228
  35437. Node: fcvtbuf302834
  35438. Node: fdopen304806
  35439. Node: feof305397
  35440. Node: ferror305848
  35441. Node: fflush306320
  35442. Node: ffs307482
  35443. Node: fgetc307998
  35444. Node: fgetgrent308476
  35445. Node: fgetpos308827
  35446. Node: fgets309274
  35447. Node: File System Extensions310087
  35448. Node: __file_exists314499
  35449. Node: __file_tree_walk315261
  35450. Node: filelength318001
  35451. Node: fileno318754
  35452. Node: findfirst319140
  35453. Node: findnext322352
  35454. Node: _fixpath322774
  35455. Node: floor324225
  35456. Node: _flush_disk_cache324665
  35457. Node: fmod325478
  35458. Node: _fmode326043
  35459. Node: fnmatch326540
  35460. Node: fnmerge329521
  35461. Node: fnsplit330404
  35462. Node: fopen331800
  35463. Node: fork333991
  35464. Node: fpathconf334387
  35465. Node: _fpreset334994
  35466. Node: fprintf335278
  35467. Node: fpurge335673
  35468. Node: fputc336227
  35469. Node: fputs336652
  35470. Node: fread337125
  35471. Node: free337644
  35472. Node: freopen338080
  35473. Node: frexp338674
  35474. Node: fscanf339353
  35475. Node: fseek339809
  35476. Node: fsetpos341401
  35477. Node: __FSEXT_add_open_handler341876
  35478. Node: __FSEXT_alloc_fd342602
  35479. Node: __FSEXT_call_open_handlers344004
  35480. Node: __FSEXT_get_data344603
  35481. Node: __FSEXT_get_function345345
  35482. Node: __FSEXT_set_data346083
  35483. Node: __FSEXT_set_function349270
  35484. Node: fstat351151
  35485. Node: fsync354161
  35486. Node: ftell354722
  35487. Node: ftime355163
  35488. Node: ftruncate355945
  35489. Node: ftw356707
  35490. Node: _fwalk361177
  35491. Node: fwrite361697
  35492. Node: gcvt362226
  35493. Node: _get_dev_info363289
  35494. Node: _get_dos_version366105
  35495. Node: _get_volume_info368019
  35496. Node: getc370227
  35497. Node: getcbrk370670
  35498. Node: getch371048
  35499. Node: getchar371852
  35500. Node: getche372189
  35501. Node: getcwd372988
  35502. Node: getdate373749
  35503. Node: getdfree374298
  35504. Node: getdisk375082
  35505. Node: getdtablesize375508
  35506. Node: getegid375884
  35507. Node: getenv376195
  35508. Node: geteuid376674
  35509. Node: getftime376976
  35510. Node: getgid377750
  35511. Node: getgrent378052
  35512. Node: getgrgid379197
  35513. Node: getgrnam379654
  35514. Node: getgroups380116
  35515. Node: gethostname380506
  35516. Node: getitimer381433
  35517. Node: getkey382588
  35518. Node: getlogin383210
  35519. Node: getlongpass383693
  35520. Node: getmntent384603
  35521. Node: getopt388720
  35522. Node: getpagesize390261
  35523. Node: getpass390652
  35524. Node: getpgrp391519
  35525. Node: getpid391876
  35526. Node: getpwent392246
  35527. Node: getpwnam393785
  35528. Node: getpwuid394253
  35529. Node: getrlimit394714
  35530. Node: getrusage396235
  35531. Node: gets397964
  35532. Node: gettext398584
  35533. Node: gettextinfo398977
  35534. Node: gettime399854
  35535. Node: gettimeofday400466
  35536. Node: getuid401613
  35537. Node: getw401910
  35538. Node: getwd402437
  35539. Node: getxkey402891
  35540. Node: glob403504
  35541. Node: globfree409902
  35542. Node: gmtime410201
  35543. Node: _go32_conventional_mem_selector411417
  35544. Node: _go32_dpmi_allocate_dos_memory412563
  35545. Node: _go32_dpmi_allocate_iret_wrapper413841
  35546. Node: _go32_dpmi_allocate_real_mode_callback_iret415107
  35547. Node: _go32_dpmi_allocate_real_mode_callback_retf416928
  35548. Node: _go32_dpmi_chain_protected_mode_interrupt_vector418194
  35549. Node: _go32_dpmi_free_dos_memory419244
  35550. Node: _go32_dpmi_free_iret_wrapper420058
  35551. Node: _go32_dpmi_free_real_mode_callback420757
  35552. Node: _go32_dpmi_get_free_memory_information421538
  35553. Node: _go32_dpmi_get_protected_mode_interrupt_vector422893
  35554. Node: _go32_dpmi_get_real_mode_interrupt_vector423834
  35555. Node: _go32_dpmi_lock_code424617
  35556. Node: _go32_dpmi_lock_data425405
  35557. Node: _go32_dpmi_remaining_physical_memory426129
  35558. Node: _go32_dpmi_remaining_virtual_memory426671
  35559. Node: _go32_dpmi_resize_dos_memory427217
  35560. Node: _go32_dpmi_set_protected_mode_interrupt_vector428220
  35561. Node: _go32_dpmi_set_real_mode_interrupt_vector430164
  35562. Node: _go32_dpmi_simulate_fcall430959
  35563. Node: _go32_dpmi_simulate_fcall_iret432134
  35564. Node: _go32_dpmi_simulate_int433320
  35565. Node: _go32_info_block434507
  35566. Node: _go32_interrupt_stack_size437930
  35567. Node: _go32_my_cs438348
  35568. Node: _go32_my_ds438754
  35569. Node: _go32_my_ss439130
  35570. Node: _go32_rmcb_stack_size439516
  35571. Node: _go32_want_ctrl_break439928
  35572. Node: _go32_was_ctrl_break_hit440894
  35573. Node: gotoxy441725
  35574. Node: gppconio_init442094
  35575. Node: hasmntopt442621
  35576. Node: highvideo443187
  35577. Node: htonl443504
  35578. Node: htons444060
  35579. Node: hypot444609
  35580. Node: inb445749
  35581. Node: index446058
  35582. Node: initstate446659
  35583. Node: inp447143
  35584. Node: inportb447459
  35585. Node: inportl447958
  35586. Node: inportsb448475
  35587. Node: inportsl448843
  35588. Node: inportsw449213
  35589. Node: inportw449583
  35590. Node: inpw450086
  35591. Node: insline450405
  35592. Node: insque450760
  35593. Node: int386451400
  35594. Node: int386x451826
  35595. Node: int86452268
  35596. Node: int86x456418
  35597. Node: intdos457153
  35598. Node: intdosx457552
  35599. Node: intensevideo457978
  35600. Node: _invent_inode459019
  35601. Node: ioctl (DOS)460175
  35602. Node: ioctl (General description)467358
  35603. Node: ioctl (UNIX)467954
  35604. Node: _is_executable468398
  35605. Node: _is_remote_drive470384
  35606. Node: _is_remote_handle471134
  35607. Node: isalnum471922
  35608. Node: isalpha472284
  35609. Node: isascii472616
  35610. Node: isatty472977
  35611. Node: iscntrl473429
  35612. Node: isdigit473782
  35613. Node: isgraph474112
  35614. Node: islower474508
  35615. Node: isprint474851
  35616. Node: ispunct475243
  35617. Node: isspace475638
  35618. Node: isupper476049
  35619. Node: isxdigit476406
  35620. Node: itoa476796
  35621. Node: kbhit477729
  35622. Node: kill478548
  35623. Node: labs478926
  35624. Node: ldexp479246
  35625. Node: ldiv479990
  35626. Node: _lfn_gen_short_fname480760
  35627. Node: _lfn_get_ftime483076
  35628. Node: __libc_termios_init484776
  35629. Node: libm485352
  35630. Node: link491450
  35631. Node: llabs491988
  35632. Node: lldiv492330
  35633. Node: load_npx493130
  35634. Node: localeconv494510
  35635. Node: localtime497389
  35636. Node: lock497902
  35637. Node: log498714
  35638. Node: log10499223
  35639. Node: log1p499739
  35640. Node: log2500336
  35641. Node: longjmp500858
  35642. Node: lowvideo501673
  35643. Node: lseek501984
  35644. Node: malloc502776
  35645. Node: matherr503579
  35646. Node: mblen507698
  35647. Node: mbstowcs508317
  35648. Node: mbtowc508858
  35649. Node: memccpy509485
  35650. Node: memchr510503
  35651. Node: memcmp511035
  35652. Node: memcpy511478
  35653. Node: memicmp512045
  35654. Node: memmove512639
  35655. Node: memset513231
  35656. Node: mkdir513852
  35657. Node: mkfifo514554
  35658. Node: mknod514922
  35659. Node: mkstemp515760
  35660. Node: mktemp516727
  35661. Node: mktime517540
  35662. Node: modf519146
  35663. Node: modfl519868
  35664. Node: _mono_clear520327
  35665. Node: _mono_printf520631
  35666. Node: _mono_putc520987
  35667. Node: movedata521313
  35668. Node: movedatab522952
  35669. Node: movedatal523338
  35670. Node: movedataw523776
  35671. Node: movetext524213
  35672. Node: mprotect524651
  35673. Node: _my_cs525847
  35674. Node: _my_ds526225
  35675. Node: _my_ss526601
  35676. Node: nice526975
  35677. Node: normvideo527349
  35678. Node: nosound527674
  35679. Node: ntohl527946
  35680. Node: ntohs528497
  35681. Node: open529042
  35682. Node: _open531443
  35683. Node: opendir532202
  35684. Node: outb534125
  35685. Node: outp534452
  35686. Node: outportb534781
  35687. Node: outportl535242
  35688. Node: outportsb535708
  35689. Node: outportsl536075
  35690. Node: outportsw536444
  35691. Node: outportw536814
  35692. Node: outpw537279
  35693. Node: pathconf537616
  35694. Node: pause539790
  35695. Node: pclose540161
  35696. Node: perror540775
  35697. Node: pipe541352
  35698. Node: popen541695
  35699. Node: pow542997
  35700. Node: pow10544102
  35701. Node: pow2544871
  35702. Node: powi545631
  35703. Node: _preserve_fncase546439
  35704. Node: printf548028
  35705. Node: psignal551440
  35706. Node: _put_path552228
  35707. Node: putc558569
  35708. Node: putch558995
  35709. Node: putchar559506
  35710. Node: putenv559926
  35711. Node: puts560805
  35712. Node: puttext561243
  35713. Node: putw561632
  35714. Node: qsort562151
  35715. Node: raise563696
  35716. Node: rand564088
  35717. Node: rand48565380
  35718. Node: random567623
  35719. Node: rawclock568077
  35720. Node: read568550
  35721. Node: _read569233
  35722. Node: read_child569837
  35723. Node: read_sel_addr570716
  35724. Node: readdir571433
  35725. Node: realloc572482
  35726. Node: redir_cmdline_delete573339
  35727. Node: redir_cmdline_parse574355
  35728. Node: redir_debug_init576631
  35729. Node: redir_to_child581582
  35730. Node: redir_to_debugger583113
  35731. Node: regcomp584611
  35732. Node: regerror599364
  35733. Node: regexec601733
  35734. Node: regfree607640
  35735. Node: remove608156
  35736. Node: remque608660
  35737. Node: _rename609269
  35738. Node: rename610586
  35739. Node: rewind612175
  35740. Node: rewinddir612597
  35741. Node: rindex613084
  35742. Node: rmdir613683
  35743. Node: run_child614138
  35744. Node: save_npx617020
  35745. Node: sbrk618383
  35746. Node: scanf619316
  35747. Node: Screen Variables626568
  35748. Node: ScreenClear627703
  35749. Node: ScreenCols628219
  35750. Node: ScreenGetChar628928
  35751. Node: ScreenGetCursor629983
  35752. Node: ScreenMode630562
  35753. Node: ScreenPutChar631066
  35754. Node: ScreenPutString631754
  35755. Node: ScreenRetrieve632543
  35756. Node: ScreenRows633298
  35757. Node: ScreenSetCursor633913
  35758. Node: ScreenUpdate634480
  35759. Node: ScreenUpdateLine635043
  35760. Node: ScreenVisualBell635577
  35761. Node: searchpath636113
  35762. Node: seekdir637868
  35763. Node: select638540
  35764. Node: _set_screen_lines644399
  35765. Node: setbuf645567
  35766. Node: setbuffer646409
  35767. Node: setcbrk647272
  35768. Node: _setcursortype647700
  35769. Node: setdate648185
  35770. Node: setdisk648667
  35771. Node: setenv649159
  35772. Node: setftime649752
  35773. Node: setgid650571
  35774. Node: setgrent651034
  35775. Node: setitimer651486
  35776. Node: setjmp655635
  35777. Node: setlinebuf656456
  35778. Node: setlocale657168
  35779. Node: setmntent658336
  35780. Node: setmode659594
  35781. Node: setpgid661017
  35782. Node: setpwent661342
  35783. Node: setrlimit661745
  35784. Node: setsid662244
  35785. Node: setstate662628
  35786. Node: settime663057
  35787. Node: settimeofday663538
  35788. Node: setuid664038
  35789. Node: setvbuf664503
  35790. Node: sigaction665597
  35791. Node: sigaddset667121
  35792. Node: sigdelset667615
  35793. Node: sigemptyset668120
  35794. Node: sigfillset668729
  35795. Node: sigismember669648
  35796. Node: siglongjmp670212
  35797. Node: signal670510
  35798. Node: sigpending679640
  35799. Node: sigprocmask680913
  35800. Node: sigsetjmp684707
  35801. Node: sin685002
  35802. Node: sincos686212
  35803. Node: sinh687192
  35804. Node: sleep687902
  35805. Node: sound688338
  35806. Node: spawn*688690
  35807. Node: sprintf694244
  35808. Node: sqrt694657
  35809. Node: srand695072
  35810. Node: srandom695592
  35811. Node: sscanf696118
  35812. Node: stackavail696595
  35813. Node: stat697012
  35814. Node: statfs701968
  35815. Node: _status87703091
  35816. Node: _stklen704248
  35817. Node: stpcpy704705
  35818. Node: strcasecmp705118
  35819. Node: strcat705644
  35820. Node: strchr706062
  35821. Node: strcmp706609
  35822. Node: strcoll707134
  35823. Node: strcpy707708
  35824. Node: strcspn708094
  35825. Node: strdup708747
  35826. Node: strerror709359
  35827. Node: strftime709877
  35828. Node: stricmp712702
  35829. Node: strlen713215
  35830. Node: strlwr713663
  35831. Node: strncasecmp714110
  35832. Node: strncat714733
  35833. Node: strncmp715170
  35834. Node: strncpy715740
  35835. Node: strnicmp716172
  35836. Node: strpbrk716781
  35837. Node: strrchr717299
  35838. Node: strsep717787
  35839. Node: strspn718720
  35840. Node: strstr719362
  35841. Node: strtod719829
  35842. Node: strtok720665
  35843. Node: strtol721498
  35844. Node: _strtold722460
  35845. Node: strtoll723058
  35846. Node: strtoul724011
  35847. Node: strtoull724571
  35848. Node: strupr725151
  35849. Node: strxfrm725580
  35850. Node: swab726212
  35851. Node: symlink726830
  35852. Node: syms_init728429
  35853. Node: syms_line2val729371
  35854. Node: syms_listwild730486
  35855. Node: syms_module732789
  35856. Node: syms_name2val733521
  35857. Node: syms_val2line735810
  35858. Node: syms_val2name736894
  35859. Node: sync738291
  35860. Node: sys_errlist738913
  35861. Node: sys_nerr739330
  35862. Node: sysconf739774
  35863. Node: system740623
  35864. Node: tan749123
  35865. Node: tanh749742
  35866. Node: tcdrain750279
  35867. Node: tcflow750885
  35868. Node: tcflush751767
  35869. Node: tcgetattr752492
  35870. Node: tcgetpgrp753227
  35871. Node: tcsendbreak753949
  35872. Node: tcsetattr754522
  35873. Node: tcsetpgrp755373
  35874. Node: tell756298
  35875. Node: telldir756711
  35876. Node: tempnam757292
  35877. Node: Termios functions759577
  35878. Node: textattr766282
  35879. Node: textbackground766986
  35880. Node: textcolor767340
  35881. Node: textmode767679
  35882. Node: time768466
  35883. Node: times768872
  35884. Node: tmpfile769823
  35885. Node: tmpnam770384
  35886. Node: toascii771989
  35887. Node: tolower772444
  35888. Node: toupper772909
  35889. Node: _truename773375
  35890. Node: truncate775373
  35891. Node: ttyname775818
  35892. Node: tzset776246
  35893. Node: tzsetwall776757
  35894. Node: uclock777232
  35895. Node: umask778934
  35896. Node: uname779241
  35897. Node: ungetc780090
  35898. Node: ungetch780588
  35899. Node: unlink780990
  35900. Node: unlock781403
  35901. Node: _use_lfn781799
  35902. Node: usleep785070
  35903. Node: utime785874
  35904. Node: utimes786850
  35905. Node: v2loadimage788135
  35906. Node: varargs790284
  35907. Node: vfork792302
  35908. Node: vfprintf792707
  35909. Node: vfscanf793379
  35910. Node: vprintf793866
  35911. Node: vscanf794317
  35912. Node: vsprintf794808
  35913. Node: vsscanf795279
  35914. Node: wait795794
  35915. Node: waitpid796626
  35916. Node: wcstombs797262
  35917. Node: wctomb797765
  35918. Node: wherex798264
  35919. Node: wherey798566
  35920. Node: wild798863
  35921. Node: window799688
  35922. Node: write800103
  35923. Node: _write801922
  35924. Node: write_child803711
  35925. Node: write_sel_addr804727
  35926. Node: xfree805537
  35927. Node: xmalloc806243
  35928. Node: xrealloc807018
  35929. Node: Unimplemented807869
  35930. Node: Master Index810505
  35931. 
  35932. End Tag Table
  35933.